Re: Build objects at runtime
Re: Build objects at runtime
- Subject: Re: Build objects at runtime
- From: Steve Sims <email@hidden>
- Date: Mon, 26 Jul 2004 15:01:22 -0400
On 26 Jul 2004, at 14:42, Peter Karlsson wrote:
Dear list!
Attached to my main window is a drawer.
When the user press a button I want to programatically build a tabview
with 1 - 20 tabs depending on what the user decides to do.
Under the different tabs I want to build buttons, sliders and so on,
also depending on what the user decides to do.
I want the tabview to show up in the drawer next time the user opens
the drawer. And I want the tabview to be saved so the next time the
user opens the app everything is still there.
I can't do this in IB because it's the user that decides at runtime
how many tabs, buttons, sliders and so on that is gonna be used. I
suppose I must programatically build a nib file at runtime, but how?
Can someone please give me some guidelines how to do all this so I can
continue search on the internet for more information?
It sounds like you want to read up on NSView's addSubview calls.
Off the top of my head what you'll need to do in IB is have an empty
NSView where you want your tabview's placed. Link this to an outlet in
your controller. Then just use that outlet to use the addSubview
calls, adding in the tab views, and use addSubviews on the tab views
too to add in your buttons, sliders etc.
Doing this you're not programatically creating a nib at runtime, but
you are programatically creating views at runtime.
Saving this is a matter of saving out the data model that defines the
tabs and sliders.
Steve
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.