• 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
init toolbar item frame with custom view (Was: tooltip event/notification?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

init toolbar item frame with custom view (Was: tooltip event/notification?)


  • Subject: init toolbar item frame with custom view (Was: tooltip event/notification?)
  • From: Luc Vandal <email@hidden>
  • Date: Wed, 17 Aug 2005 16:04:39 -0400

Hi,

Subclassing seems to do the trick. However, when I set the frame, how can I get the toolbar item frame? Currently I've been able to test things out with some arbitrary values. Here's some code:

NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
view = [[VRToolbarItemView alloc] initWithFrame:NSMakeRect (0,0,500,500)];
NSTrackingRectTag tag = [view addTrackingRect:NSMakeRect( 0, 0, 500, 500 ) owner:view userData:nil assumeInside:NO];
...
[toolbarItem setTarget: view];
...
[toolbarItem setView:view];
...


Thanks!

Luc



On 19-Jul-05, at 10:46 AM, SA Dev wrote:

No sample code needed, really. If you understand subclassing an NSView and overriding the mouse-related methods (such as - mouseEntered:) to fire your own code, you're half-way there.

Just create an NSToolbarItem as you normally would, but create an instance of your custom view and use the -setView: method. You have to make sure the size is correct so things don't get clipped, etc.

If you have a specific question, I'm sure the list will respond with a specific answer. Also, the whole "GIYF" (google is your friend) principle works well here - there's probably a wealth of examples in the list archives.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Core Data SQL store looses data that XML store does not
  • Next by Date: NSApplicationMain() doesn't set NSApp to my subclass
  • Previous by thread: Re: Anyone used iTableColumnHeader?
  • Next by thread: NSApplicationMain() doesn't set NSApp to my subclass
  • Index(es):
    • Date
    • Thread