[Top][All Lists]

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

NSButtonCell in NSTableView problem

From: Andreas Höschler
Subject: NSButtonCell in NSTableView problem
Date: Wed, 28 Nov 2007 18:14:24 +0100

Hi all,

I am pulling my hair out. In a preferences panel I am building a tableView manually with three columns, one tableColumn with a button cell:

        tableColumn  = [[NSTableColumn alloc] initWithIdentifier:@"active"];

NSButtonCell *buttonCell = [[GSButtonCell alloc] initTextCell:@""];
              [buttonCell setButtonType:NSSwitchButton];
              [buttonCell setImagePosition:NSImageOnly];
              [buttonCell setSelectable:NO];
              [tableColumn setDataCell:buttonCell];
              [buttonCell release];

[(NSCell *)[tableColumn dataCell] setAlignment:NSCenterTextAlignment];

      [tableView addTableColumn:tableColumn];

   [tableView setDataSource:self];
   [tableView setDelegate:self];
   [[tableView tableColumnWithIdentifier:@"active"] setEditable:YES];
[[[tableView tableColumnWithIdentifier:@"active"] dataCell] setEditable:YES]; [[[tableView tableColumnWithIdentifier:@"active"] dataCell] setSelectable:YES];

When I click on the switch I expect

- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(int)row;

to be called but that is not the case. If I doubleclick into one of the NSTextFieldCells and end editing then the method is called!? What am I missing. This neither works on GNustep nor on MacOSX so I must be missing something obvious but I don't see what. Any idea?

Thanks a lot,


reply via email to

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