Hello,
I'm trying to find a way to nicely create buttons dynamically. The following image describes pretty well the result I'm aiming to obtain:
I've made the following with the interface builder:
Clicking the "List" button creates a NSMutableArray with the contents of the "test.txt" file. Good so far. Now I would like to create one button per entry in that array and make these appear like they do in the "tags application" I used as an example.
I'd like to write the following in objective-c: "please put the buttons side by side in the NSBox".
For the record, this is my best guess so far... nothing happens though
That's where I'm stuck and need your help!
Thanks for your time,
Mag.
I'm trying to find a way to nicely create buttons dynamically. The following image describes pretty well the result I'm aiming to obtain:

I've made the following with the interface builder:
Clicking the "List" button creates a NSMutableArray with the contents of the "test.txt" file. Good so far. Now I would like to create one button per entry in that array and make these appear like they do in the "tags application" I used as an example.
I'd like to write the following in objective-c: "please put the buttons side by side in the NSBox".
For the record, this is my best guess so far... nothing happens though
Code:
NSRect frame = {{0.0, 0.0}, {50.0, 20.0}};
NSButton *myButton = [[[NSButton alloc] initWithFrame: frame] autorelease];
[tagBox addSubview: myButton];
[myButton setTitle: @"OK"];
That's where I'm stuck and need your help!
Thanks for your time,
Mag.