Re: tool tips for tableview?
Re: tool tips for tableview?
- Subject: Re: tool tips for tableview?
- From: David Martin <email@hidden>
- Date: Sat, 17 Aug 2002 21:38:38 +0200
On Saturday, August 17, 2002, at 04:57 , Matthew Weinstein wrote:
I noticed that in finder, a tooltip pops up for long file names that
have been contracted. I would like to add that as a feature to my
ethnographic analysis software (TAMS Analyzer), as long code names
often get cut off; but I can't find a method to assign a mouse-over
text... Suggestions?
Matthew,
NSTableView is a subclass of NSView, and NSView has a
-addToolTipRect:owner:userData: method.
In your NSTableView delegate, implement
-tableView:willDisplayCell:forTableColumn:row:, and add the tooltip
there. My personal experience tells me to remove all tooltips before
reloading the table (especially if your table contents are dynamic).
Here's an example:
Somewhere in your code:
[yourTable removeAllToolTips];
[yourTable reloadData];
In your table delegate:
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn row:(int)rowIndex {
[yourTable addToolTipRect:[yourTable frameOfCellAtColumn:[yourTable
columnWithIdentifier:@"columnIdentifier"] row:rowIndex]
owner:@"yourTooltip" user
Data:nil];
}
David
_______________________________________________
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.