How to disable few NSButtons in a matrix of push buttons? Each button has a specific tag and title. To achieve this functionality the button should be bordered or borderless?
Asked
Active
Viewed 154 times
1 Answers
0
You can create an IBOutlet
for the NSMatrix
.
Then :
[[self.buttonMatrix cellWithTag:1] setEnabled:NO];
Similarly for others. Instead of tag
, you can also use title
EDIT, doing in loop
for (NSButtonCell *button in [self.matrix cells]) {
if (button.tag==1) {
[button setEnabled:NO];
}
}

Anoop Vaidya
- 46,283
- 15
- 111
- 140
-
Not for the selected cell. While loading the window itself – user2118335 Mar 26 '13 at 08:30
-
can you Please display the old solution? – user2118335 Mar 26 '13 at 09:45
-
@user2118335: that was valid only for checkbox or radio not for other buttons. what you want ? – Anoop Vaidya Mar 26 '13 at 09:55
-
NSString *button=[[self.matrixButtons selectedCell] title]; if ([button isEqualToString:@"Some Title"]) { [[self.matrixButtons selectedCell] setEnabled:NO]; } – Anoop Vaidya Mar 26 '13 at 09:57