Re: Adding NSButton(s) to NSScrollView programmatically
Re: Adding NSButton(s) to NSScrollView programmatically
- Subject: Re: Adding NSButton(s) to NSScrollView programmatically
- From: Anthony Arthur <email@hidden>
- Date: Wed, 18 Sep 2002 22:33:20 -0400
//insert a button for each app found
while ( path = [paths nextObject] ) {
NSString* appName = nil;
toolbarButton = [[NSButton alloc] initWithFrame:NSMakeRect(
[appPaths indexOfObject:path]*40,0,40,40)];
//associate an object with the button to use as a filename
when clicked
[[toolbarButton cell] setRepresentedObject:path];
[toolbarButton setTarget:launchWell];
[toolbarButton setAction: @selector(performService:)];
[toolbarButton setEnabled:YES];
//get the app name and use it as a tool tip
appName = [[path lastPathComponent]
stringByDeletingPathExtension];
[toolbarButton setToolTip:appName];
[toolbarButton setImagePosition:NSImageOnly];
//workspace know how to get the icon for this button
[toolbarButton setImage:[workspace iconForFile:path]];
//add the subview
[[toolbarView documentView] addSubview: toolbarButton];
[toolbarButton release];
}
On Wednesday, September 18, 2002, at 08:18 AM, Pete Carss wrote:
>
subject says it all really... I know its possible because I can do it
>
it IB, but does anyone have any pointers as to how to do it
>
programmatically...
>
>
Pete
>
_______________________________________________
>
cocoa-dev mailing list | email@hidden
>
Help/Unsubscribe/Archives:
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.