ex11 widget standardization

Joe Armstrong (AL/EAB) joe.armstrong@REDACTED
Thu Feb 3 13:26:08 CET 2005

Wow - a user :-)

Overall strategy:

	1) Fix a reasonably intuitive way of programming GUIs
	2) Prototype it
	3a) *Define* a graphics GUI protocol
	3a) *Define* a look-and-feel
	4) Implement it

For many years I didn't really know how graphics should be programmed
Callbacks suck - in early attempts I made

	One window = One processes

With "if the process dies the widow dies and vice versa" semantics.

This is wrong.

EX11 convinced me that the correct model is

	One process per object in a hierarchical tree
	Expose protocols towards the objects and NOT APIs

So in ex11 *everything* is a process buttons, sliders, entries, ...
all are processes.

All obey a generic protocol and a private protocol.

So all objects can be moved with an Obj ! {move,X,Y} message 
Active objects (buttons etc) can be sent functions

	Button ! {onClick, Fun} 

Meaning evaluate F() when you click on the button


Irrespective of the underlying model (wish, gtk, X11) the Erlang programmer 
should perceive a GUI as a collection of communicating processes.

IMHO this makes for a highly intuitive and easy to program way of making GUIS.

<< It's rather like the OO way of programming a GUI where EVERY control is
an object - here every control is a process>>


Ex11 works reasonably well but not out-of-the-box on all
makes and flavours of X11 and displays (in particular
color handling on non 24 bit color displays)

3a) The protocol should be something like this
	This is a summary of some of http://www.sics.se/~joe/ex11/widgets/ex11.html

     Win !! {makeButton, X, Y, Width, Ht, Color, Str) => Button
         Button ! {onClick, Fun/1} - Evaluate F(X) when clicked. X is the mouse position.
         Button ! {set, Str}         Change the text in the button 

     Win !! {makeDragBox, X, Y, Width, Height, Border, Color) => DragBox
	    DragBox ! {onDrag, F/2} evaluate F(X,Y) when dragged to X,Y

     Win !! {makeEntry, X, Y, Width, Str) => Entry
	    Entry ! {onReturn, Fun/1} - Evaluate F(Str) when return is pressed in the entry.
          Entry ! {set, Str}		Set the entry
          Entry !! read => Str   	Read the entry


Win Button Entry DragBox etc are all processes

!! is an infix RPC. A !! B => C is short for C = rpc(A, B)
3b) Needs help from a graphics designer

EX11 is non portable to windows (ie based on X11) and has certain problems
in starting up (ie handling non 24 bit color displays)

I started three days ago (by coincidence) seeing if I could use a wish
backend to ex11 - this works very nicely, I am half way through the widgets
and have managed to retain ex11 programming model.

5) Volunteers

I would like volunteers for the following:

	a) test my new graphics stuff and help with
	   TCL widget programming (any TCL buffs out there)
	b) test run my new stuff on windows and package with
	c) Discuss and help maintain the widget protocol spec
	d) Provide inputs for graphics look-and-feel
	e) implement the entire protocols with *different*
         back-ends (ie GTK/xwwidgets etc.)

Anybody who is interested please mail me

(Oh and there is also a sub-project) The Erlang desktop (like smalltalk)



> -----Original Message-----
> From: owner-erlang-questions@REDACTED
> [mailto:owner-erlang-questions@REDACTED]On Behalf Of Saifi Khan
> Sent: den 3 februari 2005 06:35
> To: erlang-questions@REDACTED
> Subject: ex11 widget standardization
> Hi:
> I am a ex11 newbie and I recently downloaded and build the package.
> The demo is fantastic and very fast!
> Is there is any plan to have widgets standardization ?
> Something like GTK+, Qt widgets?
> For example, currently the toolbar works very well, however 
> the look and feel
> is not something that the enduser would be able to appreciate.
> While searching through the archives, I could not find what is the
> overall strategy for GUI toolkit, widgets or accessability.
> Anybody knows ?
> Many, thanks to Joe Armstrong for ex11.
> -- 
> thanks
> Saifi Khan.

More information about the erlang-questions mailing list