And This is a simple "Main" to test the HBox.
- (NSTextField *)createTextField:(NSString *)text { NSTextField *field = [[NSTextField alloc] init]; [field setStringValue:text]; return [field retain]; } - (NSButton *)createButton:(NSString *)caption { NSButton *button = [[NSButton alloc] init]; [button setBezelStyle:NSRecessedBezelStyle]; [button setButtonType:NSPushOnPushOffButton]; [[button cell] setHighlightsBy:(NSCellIsBordered | NSCellIsInsetButton)]; [button setShowsBorderOnlyWhileMouseInside:YES]; [button setButtonType:NSOnOffButton]; [button setTitle:caption]; return [button retain]; } - (void)awakeFromNib { [box addItem:[self createTextField:@"Label 1"]]; [box addItem:[self createButton:@"Button 1"]]; [box removeItemAtIndex:0]; [box addItem:[self createTextField:@"Label 2"]]; [box addItem:[self createButton:@"Say"]]; }
Download Here the Test Cocoa HBox Source.
No comments:
Post a Comment