• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tooltip Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tooltip Question


  • Subject: Re: Tooltip Question
  • From: Ryan Stevens <email@hidden>
  • Date: Mon, 26 May 2003 08:55:50 -0700

On Monday, May 26, 2003, at 01:30 AM, Andreas Mayer wrote:

> Am Sonntag, 25.05.03 um 20:57 Uhr schrieb Ryan Stevens:
>
>> I can't return nil from view:stringForToolTip:point:userData:!?!
>
> Not sure what your problem is. Returning nil works fine for me.
>
A while back I had played with tooltips and never had a problem
returning nil. This time, however, it's not playing nice....

Thread 0 Crashed:
#0 0x907e1fe8 in _NSAddExceptionHandlerForLock
#1 0x930759d4 in _NSAppKitLock
#2 0x930a69ac in +[NSFont _surrogateFontName:]
#3 0x9308722c in +[NSFont _findFont:size:matrix:flag:]
#4 0x9309f370 in +[NSFont _fontWithName:size:matrix:]
#5 0x930b2680 in +[NSFont _makeSpecialFontName:size:matrix:bit:]
#6 0x9316f1e0 in -[NSToolTipManager displayToolTip:]
#7 0x931b2694 in toolTipTimerFired
#8 0x90163230 in __CFRunLoopDoTimer
#9 0x90148d28 in __CFRunLoopRun
#10 0x90180f58 in CFRunLoopRunSpecific
#11 0x969a3b70 in RunCurrentEventLoopInMode
#12 0x969b3b00 in ReceiveNextEventCommon
#13 0x969dabbc in BlockUntilNextEventMatchingListInMode
#14 0x9308dedc in _DPSNextEvent
#15 0x930a0158 in -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:]
#16 0x00012ec0 in 0x12ec0
#17 0x930b1d88 in -[NSApplication run]
#18 0x9315fc58 in NSApplicationMain
#19 0x00004200 in 0x4200
#20 0x00004080 in 0x4080

>> I've mostly got my NSTableView to display tooltips as I like
>
> Well, you might want to have a look at my AMToolTipTableView class
> anyway:
>
> http://www.harmless.de/cocoa.html#tttv
>
Looks ok. I couldn't get it to work right off the bat though. My
subclass was in the way so I tried wedging it in which didn't really
work. I only spent a couple minutes on it so I'll give it another go
after I pound out the rest of this email.

Below is what I'm using to get my tooltips. It's not a very generalized
solution and you have to mouse out and back in to get a different
tooltip - if that makes sense. If I can't get your solution to work
I'll dig up some of my old code to re-tool - if I remember correctly I
had a pretty decent solution at some point. Anyway...

- (void)viewWillStartLiveResize { [self removeAllToolTips]; }

- (void)viewDidEndLiveResize {
[self addToolTipRect:[self frame] owner:self userData:nil];
}

- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag
point:(NSPoint)point userData:(void *)data
{
NSString *tip;
int row = [self rowAtPoint:point];

// returning nil here caused problems (and an occasional crash)
if (row == -1) return @"";

// should be fairly cheap and it's easy
tip = [[self dataSource] tableView:self
objectValueForTableColumn:nil row:row];

// just in case
if (!tip) return @"";

return tip;
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: Tooltip Question
      • From: Andreas Mayer <email@hidden>
    • Re: Tooltip Question
      • From: Ryan Stevens <email@hidden>
References: 
 >Re: Tooltip Question (From: Andreas Mayer <email@hidden>)

  • Prev by Date: [SOLVED] Transparent NSTextView makes hole in window ?
  • Next by Date: Re: Geometric computation software
  • Previous by thread: Re: Tooltip Question
  • Next by thread: Re: Tooltip Question
  • Index(es):
    • Date
    • Thread