[GUI] Common GUI API : What would the code look like?

Glynn Clements glynn.clements@virgin.net
Fri, 7 Mar 2003 00:46:26 +0000


John Meacham wrote:

> the widget name could just be another property, settable by whatever our
> standard get/set routines turn out to be.

On Xt, the widget name:

a) isn't a property,
b) has to be specified at creation time, and
c) cannot subsequently changed.

You could fudge a), by making the property-handling code have a
special-case trap for the name; but that's ugly.

BTW, some properties have to be specified at creation time, and can't
subsequently be changed.

> if 90% of toolkits ignore the
> name anyway, forcing a user to specify them always would probably result
> in people giving them meaningless names anyway if they don't know what
> they are for.

The proportion of toolkits doesn't matter; if you want to write code
which works on all toolkits, you have to have a name.

Also, there are benefits to having named widgets; e.g. it would be
possible to implement some of Xt's features on other toolkits.

> we can probably generate somewhat useful names
> automatically.  like button1..button3 for the first three children
> buttons of a given widget or whatnot... 

That results in a maintenance headache. If you add another widget,
subsequent widgets would get renamed, and you would then have to
change the resource files to match. Similarly, if a widget is
optional, the names of subsequent widgets would vary.

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