Re: Dynamic UI
Re: Dynamic UI
- Subject: Re: Dynamic UI
- From: Laurent Daudelin <email@hidden>
- Date: Sun, 30 Nov 2003 12:30:57 -0500
on 30/11/03 12:03, George Bridgeman at email@hidden wrote:
>
Hi people,
>
>
I'm new to Cocoa, so forgive me if this is an obvious question, but I
>
can't seem to find an answer in any of my Cocoa books.
>
>
How can I adjust the number/position/size/type of controls on the UI at
>
runtime? For example, if the number of controls that should appear on a
>
window are determined by certain rows in a database, how can I create
>
the controls on the fly? Let's say I wanted to create an NSTextField at
>
position (X,Y) with a size of AxB, can I do this at runtime?
>
>
I've seen this done in Windows MFC applications, and the scenario above
>
would be done by creating a new CEdit, storing a pointer to it, and
>
adjusting the properties before it is displayed on the screen. This can
>
be done for all types of control with no real problem. Is there a
>
similar way to do this with Cocoa? As the UI is defined by the NIB
>
file, I'm guessing not.
Every control is a subclass of NSView. Usually, NSView and its subclasses
are created with 'initWithFrame:', but some controls may have their own
specialized initializers. You then have to set the attributes of the
specific control you want to create. Finally, you need to add it to the
superview into which it will be displayed. Sometimes, that's the window's
content view.
-Laurent.
--
============================================================================
Laurent Daudelin AIM/iChat: LaurentDaudelin <
http://nemesys.dyndns.org>
Logiciels Nemesys Software
mailto:email@hidden
brain dump n.: [common] The act of telling someone everything one knows
about a particular topic or project. Typically used when someone is going to
let a new party maintain a piece of code. Conceptually analogous to an
operating system core dump in that it saves a lot of useful state before an
exit. "You'll have to give me a brain dump on FOOBAR before you start your
new job at HackerCorp." See core dump (sense 4). At Sun, this is also known
as `TOI' (transfer of information).
_______________________________________________
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.
References: | |
| >Dynamic UI (From: George Bridgeman <email@hidden>) |