[GUI] Setting properties of a widget.

Glynn Clements glynn.clements@virgin.net
Tue, 1 Apr 2003 01:22:45 +0100


Axel Simon wrote:

> > > d) setting a property and getting a result
> > 
> > This would be most useful for setting callbacks and
> > returning the removeHandler.  Is there any other place
> > where this would be useful?  Perhaps this is a special
> > case?
> 
>  Might be. But callbacks are very important and there will be plenty of 
> them. So it would be nice to have the same infrastructure for them as for 
> the other attributes.

I don't think that it makes sense to treat callbacks as attributes. 
The underlying UI toolkits don't generally take this approach.

BTW, with Motif, a callback *list* is implemented as a widget
property, but this fact is almost never exploited. Programs add and
remove callbacks using specific functions (XtAddCallback,
XtRemoveCallback etc) rather than using Xt[Va]SetValues to set the
callback list. There isn't a string-to-callback-list converter, so you
can't initialise a callback list in a resource file.

Not treating callbacks as attributes also avoids messing up the
attribute-setting interface in order to handle the removal issue.

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