hi i been have trouble with NSbutton State and If statments.
i have Subclassed the NSButton therefore i have used "self" as the button.
example :
but this seem to not work. is their a way to declare the Button state properly or is this properly.
i have [self allowsMixedState:YES]; on so it mixed state will be on.
if you can help me out that would be great.
One more question.:
is their any way for a button to have more than 3 states. if soo how.?
would i need to code the new states?
i have a pdf of all the button class references so please dont tell me to look ate them cause i already have like 20 times.
thanks in advanced
ok i figure out the right way to use states.
here is my AwakeFromNib section.
but there is some thing wrong. the buttons title will not change. it is always on OFF. if i click on the button "which turns the button state ON" the title is still "OFF" but the button is darken as it would be if it were On or Mixed. do any of you know why this is happening?
i have Subclassed the NSButton therefore i have used "self" as the button.
example :
Code:
if (self == NSOnState) {
[self setTitle:@"Button On"];
}else if (self == NSOffState){
[self setTitle:@"Button Off"];
}else{
[self setTitle:@"Button Mixed"];
}
but this seem to not work. is their a way to declare the Button state properly or is this properly.
i have [self allowsMixedState:YES]; on so it mixed state will be on.
if you can help me out that would be great.
One more question.:
is their any way for a button to have more than 3 states. if soo how.?
would i need to code the new states?
i have a pdf of all the button class references so please dont tell me to look ate them cause i already have like 20 times.
thanks in advanced
ok i figure out the right way to use states.
Code:
-(void) awakeFromNib {
[self setAllowsMixedState:YES];
[self setButtonType: NSPushOnPushOffButton];
if ([self state] != NSOnState || NSMixedState) {
[self setTitle:@"OFF"];
}else if ([self state] != NSOffState || NSMixedState) {
[self setTitle:@"ON"];
}else if ([self state] != NSOnState || NSOffState) {
[self setTitle:@"Mixed"];
}
}
but there is some thing wrong. the buttons title will not change. it is always on OFF. if i click on the button "which turns the button state ON" the title is still "OFF" but the button is darken as it would be if it were On or Mixed. do any of you know why this is happening?