Re: Programatically Designing a GUI
Re: Programatically Designing a GUI
- Subject: Re: Programatically Designing a GUI
- From: "Simson L. Garfinkel" <email@hidden>
- Date: Thu, 9 Aug 2001 18:06:19 -0400
I wanted to throw in my two cents on this one. (sorry for the delay, but I
generally read my email in batches.)
Cent #1:
Ondra wrote:
>
>
>>>>>> David Lee (DL) wrote at Sat, 4 Aug 2001 19:14:13 +0000:
>
DL> but say I wanted to create an application that had a
>
DL> Aqua GUI but used no NIB files whatsoever, could it all be done
>
DL> programmatically like in the days before we had NIB files?
>
>
Firstly, there never were those days: at the very first (in the NeXTStep
>
0.99) there was no PB, but the IB was there already.
Actually, in the very early days of NeXTSTEP, there was no Interface
Builder. However, IB was one of the first applications that was written.
Cent #2:
Yes, you can create all interfaces programmatically. It is darn hard to do,
but you can do it. You simply have to instantiate your own objects. You
need to create your own Window, you need to create a View, you need to put
the View inside the Window, you need to create your own controls and
sub-views, etc. If you want to create a push-button, you need to create the
control and the cell. Then you need to manage all of the layout yourself,
manually putting things where you want it. And you're not done yet! You need
to make sure that all of the outlets are properly set, that all of the
instance variables are kosher, etc. But if you do this, and you are VERY
GOOD, you can certainly get this all to work. This is, after all, how
programs like Interface Builder and OmniView instantiate controls and so
forth on a blank canvas.
Creating your own interfaces programmatically is a lot of fun. It's a lot of
work, but it's a lot of fun.
I have a demo program that does this, and even does hit recognition. It's
called Tiny.m. If anybody wants, I'll post it. (My version of Tiny.m
currently only runs on NeXTSTEP, but I'm porting it to Cocoa this weekend.)