Discussion:
Lazy calculation of tooltip text
(too old to reply)
Jonathan Taylor
2018-07-06 15:22:56 UTC
Permalink
I have a UI item (text field) that displays a tooltip when the user hovers over it. However, the information to be displayed in the tooltip is dynamic and relatively expensive to compute. At the moment the tooltip is bound to a string property which I manually update twice a second. It seems that the right way to handle all this would be to compute the information only when I know the tooltip is about to display. However, googling and searching of headers has not led me to a way to do this. It seems that NSTextView has a method textView:willDisplayToolTip:forCharacterAtIndex: which would seem to offer the functionality I want. However, I can’t find anything equivalent for other view types.

Any suggestions on how I might supply tooltip text dynamically, when the tooltip is about to display?

[University of Glasgow: The Times Scottish University of the Year 2018]
_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@m
Jens Alfke
2018-07-06 16:12:13 UTC
Permalink
Post by Jonathan Taylor
Any suggestions on how I might supply tooltip text dynamically, when the tooltip is about to display?
@protocol NSViewToolTipOwner <NSObject>
- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(nullable void *)data;
@end

_______________________________________________

Cocoa-dev mailing list (Cocoa-***@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/gegs%40ml-in.narkive.net

This email sent to ***@ml-in.narkive.net

Continue reading on narkive:
Loading...