when I write a Filter with dialog Plugin, I user xcode edit the xib file ,I want to add 12 radio to select the color in the GlyphsApp,but those Radios were not a single selection,and I not find the way to set RadioGroup, how do it who know?
You can use a NSMatrix for that.
If you like to replicate the UI in Glyphs, you can do the following:
Set the cell class to: GSColorLabelButtonCell
Then add a method like this:
- (void)updateColors {
NSInteger i;
NSArray *labelColors = [GSGlyphsInfo labelColors];
NSInteger Columns = [_colorButtons numberOfColumns];
if (Columns == 0) {
return;
}
for (i = 0; i < [labelColors count]; i++) {
NSColor *lightColor = labelColors[i];
[[_colorButtons cellAtRow:(NSInteger)floor(i / Columns) column:i % Columns] setBackgroundColor:lightColor];
}
}
1 Like
Not one single answer from @GeorgSeifert from which one won’t learn something new.
Just want to add that I saw that “Use of NSMatrix is discouraged in apps that run in macOS 10.8 and later. …” (Apple Documentation) 10.8 is quite old already.
But it still works and replicating the behavior of an matrix (specifically when using bindings) is more complicated.
1 Like