Button in textfieldcell inside a table

Benjamin Stiglitz ben at tanjero.com
Tue Dec 11 13:58:38 PST 2007


> I was doing this by using an NSTextFieldCell subclass, overriding -
> drawRect: and -trackMouse:inRect:ofView:untilMouseUp:. This was
> working fine on Tiger. However on Leopard -trackMouse:... is not
> called anymore on a mouseDown:, so this approach completely fails.
>
> Does anyone on this list have an alternative for doing this, that
> works both on Tiger and Leopard?

On Leopard you can implement this delegate method to enable the cell  
tracking method to be called:
- (BOOL)tableView:(NSTableView *)tableView shouldTrackCell:(NSCell  
*)cell forTableColumn:(NSTableColumn *)tableColumnrow:(NSInteger)row

See the NSTableView documentation:
http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTableView_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSObject/ 
tableView:shouldTrackCell:forTableColumn:row:

-Ben


More information about the MacOSX-dev mailing list