• 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: Odd tooltip behavior in NSTableView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Odd tooltip behavior in NSTableView
      • From: Dustin Wenz <email@hidden>
References: 
 >NSTextView - calculating current col (with tabs) (From: Duncan Campbell <email@hidden>)
 >Odd tooltip behavior in NSTableView (From: Dustin Wenz <email@hidden>)

  • Prev by Date: Is NSTableView/NSOutlineView the way to go?
  • Next by Date: Re: Drawing over a view's subviews
  • Previous by thread: Odd tooltip behavior in NSTableView
  • Next by thread: Re: Odd tooltip behavior in NSTableView
  • Index(es):
    • Date
    • Thread