Re: NSBrowser tooltips (Tiger and Leopard)
Re: NSBrowser tooltips (Tiger and Leopard)
- Subject: Re: NSBrowser tooltips (Tiger and Leopard)
- From: Corbin Dunn <email@hidden>
- Date: Tue, 6 Nov 2007 15:09:21 -0800
On Leopard, the method also doesn't get called, but I do get a
tooltip for my root item (the first column of the browser has only
one item), with text that seems to be taken from the text of my
(custom) NSBrowerCell. None of the other items (incorrectly) show
tooltips at all.
That's the expansion tool tip. It is documented, and mentioned in the
release notes:
http://developer.apple.com/releasenotes/Cocoa/AppKit.html
NSCell Automatic Expansion ToolTip FrameNSCell has some new API to
support expansion tool tips in certain controls:
- (NSRect)expansionFrameWithFrame:(NSRect)cellFrame inView:(NSView
*)view;
- (void)drawWithExpansionFrame:(NSRect)cellFrame inView:(NSView
*)view;
An expansion tool tip allows one to see truncated text in a special
floating window that is similar but different from a normal ToolTip.
Currently, NSTableView, NSOutlineView and NSBrowser display
expansion tool tips when the text is truncated. If you have a cell
that will be displayed in one of these controls, it is recommended
that you implement the above methods to properly support the
expansion tool tip feature. By default, the methods are properly
implemented in NSTextFieldCell and NSBrowserCell. NSCell will always
return NSZeroRect, and prevent the expansion from happening. For an
example of how to implement it, see the SimpleBrowser demo app.
Clients of NSTableView, NSOutlineView and NSBrowser can prevent the
cell expansion from happening on a particular row/column by using
the new delegate methods declared in the appropriate header files.
However, after this tooltip has been displayed, the underlying
NSBrowserCell seems to have been released by something, judging by
the crashes I get next time it's accessed.
This is because you aren't properly implementing copyWithZone; in it,
you should retain or copy your ivars.
corbin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden