PDA

View Full Version : CheckBox Control. Application is hangs




Sergio10
Apr 1, 2009, 04:46 PM
Hi I have next event which binds to check box:

- (IBAction)clickCheckBox:(id)sender
{
if([sender isSelected] == YES)
{
[position setStringValue: @"isSelected"];
_isChecked = YES;
}
else
{
[position setStringValue: @"notSelected"];
_isChecked = NO;
}
}

On debug, this code is hangs(at first line). Why? How to verify checkbox control it is checked?

Thanks,
Sergio



kainjow
Apr 1, 2009, 05:33 PM
isSelected is not a method that NSButton knows. Use state:
if ([sender state] == NSOnState)