Re: Tooltips over buttons ?
Re: Tooltips over buttons ?
- Subject: Re: Tooltips over buttons ?
- From: Bill Hernandez <email@hidden>
- Date: Thu, 25 Mar 2010 13:55:32 -0500
On Mar 24, 2010, at 11:53 PM, Jerry Krinock wrote:
> On 2010 Mar 24, at 21:10, Bill Hernandez wrote:
>
>> I've looked for a couple of hours trying to find a simple example on how to implement tooltips over three graphic buttons.
>
>> Most of the IB info I found during my search is very old.
>
>> I am looking for an example if possible
>
> Can't think of any examples, probably because this is so easy. But, if you've never done it before, it's not easy. Here you go...
>
> Since you mentioned IB, we'll use bindings in your nib.
>
> First of all, pick an object which can provide the needed tooltip string, that is accessible in the Bind to: popup menus in the Inspector in Interface Builder, either directly or via a key path. Often this will be your app delegate or window controller (File's Owner). Implement a method named
>
> -(NSString*)myToolTip ;
>
> which returns the string you want to see in the tooltip.
>
> Switch to Interface Builder, inspect the subject button, click Bindings tab, scroll way down to the bottom and you'll see "ToolTip". Expand it. In the popup, select the accessible object from above, and in Model Key Path paste in that key path if any followed by a dot, ending with the method name myToolTip.
Jerry,
Thank You so much...
I have spent hours on this about a month ago, then again yesterday, and all I can say is that this is so incredibly cool.
You are right, this is really simple, but I couldn't find an example anywhere, when I read the docs
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/OnlineHelp/Concepts/Tooltips.html
I swear to you all they did was confuse me...
TestNoDocAppDelegate.h
-(NSString*)insertButtonToolTip ;
TestNoDocAppDelegate.m
-(NSString*) insertButtonToolTip { return @"This is the insert button"; }
( 1 ) In IB selected the <[Insert Button]>
( 2 ) hit CMD-4
( 3 ) opened the Tooltips disclosure triangle
( 4 ) checked Bind to : TestNoDocAppDelegate
( 5 ) Model Key Path : insertButtonToolTip
... I like to use little image buttons, and now I finally have Tooltips, how incredibly awesome...
I don't know if you can tell I am excited, or not. I don't want it to show !
I hope you have a great day !
Bill Hernandez
Plano, Texas
_______________________________________________
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