Reputation: 8586
I'm developing an app for MacOSX and I'm creating a NSMatrix (Radio Buttons) like this:
arrayClasifCuentas = [[NSMutableArray alloc]init];
[arrayClasifCuentas addObject:@{@"tag": @"7",@"value": @"Seven"}];
[arrayClasifCuentas addObject:@{@"tag": @"8",@"value": @"Eight"}];
[arrayClasifCuentas addObject:@{@"tag": @"9",@"value": @"Nine"}];
NSButtonCell *prototype = [[NSButtonCell alloc] init];
[prototype setTitle:@"Radio"];
[prototype setButtonType:NSRadioButton];
NSRect matrixRect = NSMakeRect(20, 20, 125, 80);
myMatrix = [[NSMatrix alloc] initWithFrame:matrixRect
mode:NSRadioModeMatrix
prototype:(NSCell *)prototype
numberOfRows:[arrayClasifCuentas count]
numberOfColumns:1];
NSArray *cellArray = [myMatrix cells];
for (int i = 0; i < [arrayClasifCuentas count]; i++) {
[[cellArray objectAtIndex:i] setTitle:[[arrayClasifCuentas objectAtIndex:i] objectForKey:@"value"]];
[[cellArray objectAtIndex:i] setTag: [[[arrayClasifCuentas objectAtIndex:i] objectForKey:@"tag"]intValue ]];
}
what I wanna do next is to programmatically select the option seven but based on its own tag (7) how to do that???
Upvotes: 0
Views: 888