Re: Tooltip Question
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 user
Data: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.