Re: NSTableView tooltip with a view based table?
Re: NSTableView tooltip with a view based table?
- Subject: Re: NSTableView tooltip with a view based table?
- From: Tim Schröder <email@hidden>
- Date: Wed, 01 Feb 2012 18:27:09 +0100
It actually works with view-based NSTableViews. I'm not using NSArrayController but implement
- (NSView *)tableView:(NSTableView *)aTableView
viewForTableColumn:(NSTableColumn *)tableColumn
row:(NSInteger)row
where I use this code:
NSTableCellView *result;
result = [aTableView makeViewWithIdentifier:@"entriesCellView" owner:self];
result.objectValue = [self.entryController entryForRow:row];
result.toolTip = @"Any ToolTip String here";
This should also work with bindings.
Tim
Am 01.02.2012 um 17:36 schrieb Andrew:
> I have a view based NSTableView using an NSArrayController with
> NSDictionary items as rows. I would like to display a tooltip for each
> row as the "Description" key from my dictionaries. I have tried using
> the table delegate method:
> - (NSString *)tableView:(NSTableView *)aTableView
> toolTipForCell:(NSCell *)aCell rect:(NSRectPointer)rect
> tableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)row
> mouseLocation:(NSPoint)mouseLocation
>
> But it is never called. Perhaps it is only for cell-based tables, but
> not documented as such?
>
> So instead I tried to bind the tooltip of the NSTableView to the array
> controller with key arrangedObjects and model path Description, but
> that results in this error:
>
> 2012-02-01 09:22:19.512 MyApp[8860:707] -[__NSArrayI length]:
> unrecognized selector sent to instance 0x1023102c0
> 2012-02-01 09:22:19.514 MyApp[8860:707] (
> 0 CoreFoundation 0x00007fff8e144286
> __exceptionPreprocess + 198
> 1 libobjc.A.dylib 0x00007fff93719d5e
> objc_exception_throw + 43
> 2 CoreFoundation 0x00007fff8e1d04ce -[NSObject
> doesNotRecognizeSelector:] + 190
> 3 CoreFoundation 0x00007fff8e131133
> ___forwarding___ + 371
> 4 CoreFoundation 0x00007fff8e130f48
> _CF_forwarding_prep_0 + 232
> 5 AppKit 0x00007fff9211d233
> -[NSToolTipManager displayToolTip:] + 353
>
> If I try to bind the tooltip of the "Table Cell View" it is not
> displayed. I've also tried just binding the tooltip of an NSTextView
> in the row view, and still have had no luck.
>
> What is the correct way to show a tooltip for a row in a view based NSTableView?
>
> Thank you,
> Andrew
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden