Re: setToolTip: not working
Re: setToolTip: not working
- Subject: Re: setToolTip: not working
- From: Andy Lee <email@hidden>
- Date: Thu, 19 Nov 2009 07:46:20 -0500
On Nov 18, 2009, at 8:30 PM, Gregory Weston wrote:
> Ben Haller wrote:
[...]
>> I get the impression that others are not seeing it because it's a
>> problem that specially bites apps that build their UI in code, instead
>> of in IB, and that's rare. I was trying to fish for someone who would
>> say "I build my UI in code, and I don't see this problem," but nobody
>> spoke up. Are you such a person?
>
>
> I missed the beginning of this thread, but I am such a person and I don't experience the problem.
Me too. Or rather, I just did a quick test with an NSButton and a trivial custom view, and it worked. It also worked when I replaced TestView below with NSView.
- (void)awakeFromNib
{
NSWindow *testWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(100, 100, 500, 500)
styleMask:NSTitledWindowMask
backing:NSBackingStoreBuffered
defer:NO];
[testWindow makeKeyAndOrderFront:self];
NSButton *testButton = [[NSButton alloc] initWithFrame:NSMakeRect(100, 50, 100, 20)];
[testButton setTitle:@"Hover Over Me"];
[testButton sizeToFit];
[testButton setToolTip:@"This is an NSButton"];
[[testWindow contentView] addSubview:testButton];
NSView *testView = [[TestView alloc] initWithFrame:NSMakeRect(100, 100, 100, 20)];
[testView setToolTip:@"This is a test view"];
[[testWindow contentView] addSubview:testView];
}
Maybe you can temporarily add similar lines to your code and see if you see tooltips?
I know you know better, but I'll ask some obvious questions. (Yes, your geneticBasisChanged code would seem to answer many of these questions, but maybe not your other code, and when confronted with code that "can't" be failing, I try to question obvious assumptions.)
* Are you sure your calls to setToolTip: are being performed?
* Are you sure the receiver is not nil at the time of the call?
* Does [myView toolTip] return what you passed to setToolTip:?
* Are you sure the receiver is the object you intended? For example, if you log a button's address when you setToolTip:, and log the sender's address in the button's action method, do you see the address you expect when you click the button?
* Do you have any overlapping views that might be stealing the mouseEntered event?
* I also wonder if there is some OS hack or defaults setting that is suppressing tooltips in general. Do you see tooltips in other apps?
* How many views do you have that have tooltips? It *feels* like there is an extra long delay the first time I bring up a tooltip, and I wonder if there's some initial overhead that might increase with the number of tooltips.
--Andy
_______________________________________________
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