• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Adding NSButton(s) to NSScrollView programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Adding NSButton(s) to NSScrollView programmatically (From: Pete Carss <email@hidden>)

  • Prev by Date: Re: attributesAtIndex:effectiveRange: vs the insertion point at end of text
  • Next by Date: Re: Cocoa-style HTML documentation
  • Previous by thread: Adding NSButton(s) to NSScrollView programmatically
  • Next by thread: where is mouseDragged in NSTableView ??
  • Index(es):
    • Date
    • Thread