3

Why my code changes the state of selected NSButtenCell to NSOnState after first run?

NSButtonCell *b=[[NSButtonCell alloc] init];
b=[self.myMatrix selectedCell];
[self.myMatrix selectCellAtRow:0 column:0];
if (b.state == NSOnState) {
    NSLog(@"State is On");
}else{
    NSLog(@"State is Off");
}

What can I do ?

Sajad Garshasbi
  • 508
  • 1
  • 9
  • 23

1 Answers1

1

I'm not sure but did you check whether calling

[self.myMatrix selectCellAtRow:0 column:0];

performs the state change?

The Apple documentation for NSMatrix says:

> If the specified cell is an editable text cell, its text is selected.

So perhaps this method also may change the checkbox state (but I don't know if that may be the issue).

Alex
  • 1,221
  • 1
  • 10
  • 19