Re: Tooltips - what a pathetic joke... :)
Re: Tooltips - what a pathetic joke... :)
- Subject: Re: Tooltips - what a pathetic joke... :)
- From: Rainer Brockerhoff <email@hidden>
- Date: Mon, 16 Dec 2002 23:36:23 -0200
>
Date: Sat, 14 Dec 2002 09:05:43 -0600
>
From: Brian Webster <email@hidden>
>
>
>> I added tool tips to a view, then tried to scroll the view. The
>
>> performance was pathetic. When a view scrolls the NSToolTipManager
>
>> has to reposition all the tooltip tracking areas and is super slow.
>
>> So slow that I'll have to write my own home grown tooltip manager.
>
>> Why is simple stuff like this so pathetic in Cocoa?
>
>>
>
I've just run up against a similar problem to Steve's in one of my
>
apps, where I have a table view where I want to have tooltips for many
>
of the cells. It seems that the tool tip manager does not perform well
>
for moderate or large numbers of tooltips in a view. I'm guessing the
>
problem doesn't really show up with 3 tooltips as in your example, but
>
my app could easily have 60-120 tooltips to keep track of, in a table
>
with 4-6 columns and 15-20 rows. I'm afraid I don't have any solution
>
for the problem (yet), but just wanted to chime in to confirm the
>
problem.
I ran into something similar recently and the best way is to generate your tooltips yourself.
Call [yourView addToolTipRect:[yourView frame] owner:someDelegate user
Data:nil] when loading the view. This will add a single tooltip rect for your whole view. The slowdown is associated with searching through a large list of tooltip rects, I think. If your view can change size, passing some huge rect instead of the frame should also work.
Then in someDelegate, implement:
- (NSString*)view:(NSView*)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void*)data;
Inside that, check point's coordinates in some efficient way and return the appropriate tooltip NSString. For your specific case, you should be able to do something more much efficient than Cocoa's default rect list search. Tables should be very easy to do.
Tell me if it worked :-).
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"I love deadlines. I love the whooshing noise they make as they go by" (Douglas Adams)
http://www.brockerhoff.net/ now with forums for XRay, Zingg! et al.
_______________________________________________
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.