Skip navigation.
 
mlRe: NSBrowser tooltips (Tiger and Leopard)
FROM : Martin Redington
DATE : Wed Nov 07 01:51:40 2007

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
>

Related mailsAuthorDate
mlNSBrowser tooltips (Tiger and Leopard) Martin Redington Nov 6, 22:32
mlRe: NSBrowser tooltips (Tiger and Leopard) Corbin Dunn Nov 7, 00:09
mlRe: NSBrowser tooltips (Tiger and Leopard) Martin Redington Nov 7, 01:51