Reputation: 185
I am trying to implement a Radiogroup with cocoa and used the example provided by apple Using Radio Buttons
The following screenshot shows the problem I have. Even if the NSMatrix containing the cells have a NSRect large enough the cells themselves are not wide enough to display the titles.
How can I correct this?
NSButtonCell *prototype = [[[NSButtonCell alloc] init]autorelease];
[prototype setButtonType:NSRadioButton];
[prototype setBordered:YES];//only for testing
_view = [[[NSMatrix alloc] initWithFrame:rect
mode:NSRadioModeMatrix
prototype:(NSCell *)prototype
numberOfRows:3
numberOfColumns:1]autorelease];
NSArray *cellArray = [_view cells];
for (std::size_t index = 0; index < 3; ++index)
{
[[cellArray objectAtIndex:index] setTitle:@"a title"];
}
Upvotes: 1
Views: 45
Reputation: 2515
Use setCellSize of matrix.
NSSize size = [_view cellSize];
size.width = 400;
[_view setCellSize:size];
Upvotes: 1