How to make GS Widgets

Cedric Shock cedricpublic@REDACTED
Thu Apr 15 07:11:42 CEST 2004


Hello,

I have found a way to implement custom widgets for GS. Here's how it works:

Spawn and link a new process for the widget. The new process (widget) 
will need at least the process id of its creator, and the gs reference 
to the container it will be placed in. Wait for the widget to respond 
with a gs reference to the frame it has made to contain itself. The 
widget will be able to manipulate this frame, and will recieve all the 
events from this frame. The widget process can now send event-like 
messages to the calling process. The widget process should monitor the 
process that created it, so that it will exit when its creator exits.

The widget can provide an interface for feedback or control from the 
creating process. This method requires the creating process to posess 
the process id of the widget to fully manipulate it.

For a small example of how this works, see the attachments.

Are there any serious issues with taking advantage of this "undocumented 
feature" (the routing of events to the process that created the gs 
widget) to implement custom widgets? Will a process that is waiting at a 
receive clause use processor time, or will erlang put off executing it 
until there is a new message to consider?

Thank you very much for your feedback,

Cedric Shock

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mywidgets.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040414/1440a81a/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: widgettest.erl
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20040414/1440a81a/attachment-0001.ksh>


More information about the erlang-questions mailing list