[GUI] Dynamic ... something

Glynn Clements glynn.clements@virgin.net
Sat, 12 Apr 2003 21:00:51 +0100


Axel Simon wrote:

> > > Something like:
> > > nib <- loadAppleNibFile_MAC "foo.nib" -- a nib file is a document 
> > > created by Apple's Interface Builder and contains one or more dialogs
> > > dialog <- createDialogFromNib_MAC nib "MyDialog"
> > > If "MyDialog" doesn't refer to a dialog in the file, a runtime error 
> > > occurs...
> > 
> > For UIL, you also have to provide definitions for any attribute values
> > which can't be specified inside a UIL file (e.g. pointers, callbacks). 
> 
> ...so you're saying you cannot connect to widgets in the UIL files if you
> haven't specified a correspoinding attribute for the callback? We have
> to find some common ground for resource files and I doubt that Apple's
> NIB and Windows resource files can contain callback attributes. Is it
> not possible to retrieve a widget from the resource file and then add
> a callback to it? 

Yes, it's possible, but it's more common to specify a callback in the
UIL file via a symbolic name, and provide a name/value mapping when
you load the UID file, so the widget hierarchy is returned with the
callbacks already installed. You only need to programmatically add
callbacks if they come and go during execution.

The purpose of the name/value mapping is for providing values which
can't be stored in UIL/UID files; the most common cases are pointers
(primarily function pointers) and "handles". Most common attribute
types (numbers, colours, fonts, booleans, enumerated types) *can* be
specified as strings in the UIL file.

-- 
Glynn Clements <glynn.clements@virgin.net>