Re: Adding controls dynamically to a window
Re: Adding controls dynamically to a window
- Subject: Re: Adding controls dynamically to a window
- From: Matt Neuburg <email@hidden>
- Date: Wed, 4 Sep 2002 23:17:09 -0700
>
Date: Thu, 05 Sep 2002 00:10:00 -0400 (EDT)
>
From: Chris Backas <email@hidden>
>
Subject: Adding controls dynamically to a window
>
To: Cocoa List <email@hidden>
>
>
Hello,
>
>
I'm trying to do something very similar to what the Finder does under
>
Jaguar in its Find File dialog (Command-F), where you can add criteria and
>
new controls appear for you to specify more information in. I've been
>
unable to figure out from a high level how to go about this though - the
>
best thing I could find was NSMatrix, and making a custom cell to display
>
in it. Is there another approach, or should I pursue the NSMatrix way?
The simplest way is just to create the controls and stick them in there, in
code. You make the controls just as you'd make any instance (alloc
initWithFrame) and you stick them in with a form of addSubview.
If you will always be adding and removing certain sets of controls
together, you can combine them in Interface Builder in an NSView and then
just add and remove that. The Find File dialog could easily be made from a
repertoire of a dozen NSViews.
This has been discussed here many many times (in fact I just gave this same
answer two days ago) so please look at the archives.
m.
--
matt neuburg, phd = email@hidden,
http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart.
http://www.tidbits.com/
_______________________________________________
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.