• 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: NSBrowser tooltips (Tiger and Leopard)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSBrowser tooltips (Tiger and Leopard)


  • Subject: Re: NSBrowser tooltips (Tiger and Leopard)
  • From: Martin Redington <email@hidden>
  • Date: Wed, 7 Nov 2007 00:51:40 +0000


Thanks Corbin,

copyWithZone certainly fixed the crashes.

I implemented the new delegate methods for expansion tooltips in my NSBrowser and NSOutlineView (I hadn't noticed a similar rogue tooltip there) delegates (with an #ifdef for NSInteger to let it compile against Tiger), returning NO.

Bizarrely, NSLog's in the delegate methods never seem to produce any output, but the rogues tips seem to have gone away.

I'm still pretty puzzled, as although what I was seeing can't really be anything except the expansion tooltips, the cells in question weren't actually truncated, and it only seems to happen for the first (left uppermost) cell in my NSBrowser, and the first child of the root item in an NSOutlineView.

If I have time, I'll go back and see if I can work out what's going on.

I'd still love to know how to get proper tooltips working in NSBrowser though.

    cheers,
            m.

On 6 Nov 2007, at 23:09, Corbin Dunn wrote:



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


References: 
 >NSBrowser tooltips (Tiger and Leopard) (From: Martin Redington <email@hidden>)
 >Re: NSBrowser tooltips (Tiger and Leopard) (From: Corbin Dunn <email@hidden>)

  • Prev by Date: NSLayoutManager and avoiding widows and orphans
  • Next by Date: DO: Local objects passed back from the other side: Leopard vs. earlier systems
  • Previous by thread: Re: NSBrowser tooltips (Tiger and Leopard)
  • Next by thread: Custom attachment in a text view
  • Index(es):
    • Date
    • Thread