[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting checkbox with keyboard

From: Andreas Höschler
Subject: Re: Setting checkbox with keyboard
Date: Mon, 19 Nov 2007 14:55:19 +0100

Hi all,

I want to have a checkbox in a tableview and be able to tab into it from the column to its left with the TAB key and then set its state with the keyboard (e.g. the space key, any other would be fine as well). This is to avoid the need to use the mouse for very efficient data entry. I did

NSButtonCell *buttonCell = [[NSButtonCell alloc] initTextCell:@""];
              [buttonCell setButtonType:NSSwitchButton];
              [buttonCell setImagePosition:NSImageOnly];
              [buttonCell setSelectable:YES];
              [buttonCell setEditable:YES];
              [tableColumn setDataCell:buttonCell];
              [_displayObjects addObject:buttonCell];
              [buttonCell release];

This allows me to tab into and over the checkbox column on the Mac. This does not work under GNUstep! Why? I subclasses NSButtonCell

@implementation GSButtonCell

- (BOOL)acceptsFirstResponder
   BOOL result = [super acceptsFirstResponder];
   NSLog(@"%@ acceptsFirstResponder %d", self, result);
   return result;


and expected acceptsFirstResponder to be called when I try to tab into the column. However, this does not happen under GNUstep!?

When tabbing into the checkbox column on MacOSX the following method is called with an NSCBBoolean as anObject. However, the state of he boolean is always false whether the checkbox was set with the mouse before or not!?

- (void)tableView:(NSTableView *)aTableView setObjectValue:anObject forTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex

Any idea what I am missing?

If setting the state of the checkbox with the keyboard is not possible (right now) it would already help a lot if one were able to tab ove rthe checkbox column. Right now, tabbing ends when the checkbox column is reached which is very annoying for the user. Any idea how to avoid that? The tableview should just select the next editable cell behind the checkbox column for editing.

Thanks a lot!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]