Re: Odd tooltip behavior in NSTableView
Re: Odd tooltip behavior in NSTableView
- Subject: Re: Odd tooltip behavior in NSTableView
- From: Corbin Dunn <email@hidden>
- Date: Wed, 15 Jun 2005 15:36:20 -0700
I have an nstableview with a modest number of rows and columns.
Some of the cell contents can be quite long, so I need a tooltip to
display the entire cell contents when the cursor hovers over it.
Should be trivial right? I just implement this in my delegate:
- (NSString *)tableView:(NSTableView *)aTableView toolTipForCell:
(NSCell *)aCell rect:(NSRectPointer)rect tableColumn:(NSTableColumn
*)aTableColumn row:(int)row mouseLocation:(NSPoint)mouseLocation
{
return [aCell stringValue];
}
This is a little cleaner:
- (NSString *)tableView:(NSTableView *)tv toolTipForCell:(NSCell *)
cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tc row:
(int)row mouseLocation:(NSPoint)mouseLocation {
if ([cell isKindOfClass:[NSTextFieldCell class]]) {
if ([[cell attributedStringValue] size].width > rect-
>size.width) {
return [cell stringValue];
}
}
return nil;
}
--corbin
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden