Re: Setting properties of a widget.

Glynn Clements <[email protected]>
Newsgroups gmane.comp.lang.haskell.gui
Message-ID <[email protected]>
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 <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.