Checkbox in NSOutlineView. Must move mouse > 3 pixels to toggle
Checkbox in NSOutlineView. Must move mouse > 3 pixels to toggle
- Subject: Checkbox in NSOutlineView. Must move mouse > 3 pixels to toggle
- From: Jerry Krinock <email@hidden>
- Date: Thu, 27 Jul 2006 12:53:58 -0700
- Thread-topic: Checkbox in NSOutlineView. Must move mouse > 3 pixels to toggle
I have an NSOutlineView with a checkbox column. The system should send its
dataSource delegate a outlineView:setObjectValue:forTableColumn:byItem:
message whenever the user clicks the checkbox.
However, I find that once I click in a checkbox, clicking again does not
re-send outlineView:setObjectValue:forTableColumn:byItem: unless I have
moved my mouse by greater than 3 pixels in any direction from where it was
during the previous click which successfully toggled it. Waiting does not
help. You've got to move it 4 pixels or more.
Anyone have a good guess what might cause this behavior?
Jerry Krinock
The NSOutlineView has two columns. The first column is the checkbox I'm
having trouble with, the second column is the "outline" column.
The checkbox is NSSmallControlSize, 12x12 pixels and has
setAllowsMixedState:YES. When the user clicks it, it will change to
NSOnState or NSOffState. (I don't know why the user cannot change it to
NSMixedState, but fortunately this is the behavior that I want. I set it to
NSMixedState, when needed, programatically.)
The NSTableColumn in which the checkbox lives has been subclassed twice to
override dataCellForRow:. The first-level subclass returns a generic
checkbox-style NSButtonCell. The second-level subclass simply sends the
cell setAllowsMixedState:YES. Commenting out this message does not affect
the problem.
// ***** First Level Subclass
@interface SSCheckboxTableColumn : NSTableColumn
{
}
@end
@implementation SSCheckboxTableColumn
- (id)dataCellForRow:(int)iRow
{
NSButtonCell * cell =[[NSButtonCell alloc] init];
[cell setControlSize:NSSmallControlSize] ;
[cell setButtonType:NSSwitchButton] ;
[cell setTitle:@""] ;
[cell setImagePosition:NSImageOnly] ;
return [cell autorelease] ;
}
@end
// ***** Second Level Subclass
@interface TableColumnTasksCopy : SSCheckboxTableColumn
{
}
@end
@implementation TableColumnTasksCopy
- (id)dataCellForRow:(int)iRow
{
NSButtonCell * cell = [super dataCellForRow:iRow] ;
[cell setAllowsMixedState:YES] ;
return cell ;
}
@end
_______________________________________________
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