What is this Cocoa screen made of? Thanks!

Discussion in 'Mac Programming' started by magda1986, Mar 5, 2011.

  1. magda1986 macrumors newbie

    magda1986

    Joined:
    Mar 5, 2011
    #1
    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:

    [​IMG]

    I've made the following with the interface builder:
    [​IMG]

    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.
     
  2. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  3. magda1986 thread starter macrumors newbie

    magda1986

    Joined:
    Mar 5, 2011
    #4
    Thank you! It's what I needed!

    Your answer allowed to find: "M3 Token Controller". It comes with a working example.

    Have a good sunday,
    Mag
     

Share This Page