Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.