• 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 12:15:54 -0700

Okay, not the prettiest solution but it should be pretty fast and I got
it to work. I was specifically trying not to redo the tooltips in
reloadData since that gets called far too often (I think).

The only thing you can't see from the code below is that I send
noteNumberOfRowsChanged from the dataSource when, well, the number of
rows changes.


- (void)noteNumberOfRowsChanged
{
[self removeAllToolTips];
[self redoToolTips];
// I'm not informing super
}

// I don't need tooltips while resizing
- (void)viewWillStartLiveResize
{
[self removeAllToolTips];
// I'm not informing super
}

- (void)viewDidEndLiveResize
{
[self redoToolTips];
// I'm not informing super
}

- (void)redoToolTips
{
int numRows = [self numberOfRows];
int i=0;

for (;i<numRows;i++)
[self addToolTipRect:[self rectOfRow:i] owner:self userData:nil];
}

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

if (row == -1) return @"";

// Should be pretty cheap and fast
tip = [[self dataSource] tableView:self
objectValueForTableColumn:column row:row];

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.

References: 
 >Re: Tooltip Question (From: Ryan Stevens <email@hidden>)

  • Prev by Date: Re: State of instance variables defined at instantiation?
  • Next by Date: Re: Subversion revision controll system
  • Previous by thread: Re: Tooltip Question
  • Next by thread: Re: Tooltip Question
  • Index(es):
    • Date
    • Thread