ptkwt / aracnet.com (Phil Tomson) wrote in message news:<c3v8j502j6k / enews4.newsguy.com>...
> I'm thinking that we would just use Ruby to generate Mozilla XUL.  We 
> would be able to transform our GUI XML descriptions into XUL as one of 
> thee targets.  In that case we're generating JavaScript code to handle 
> events.

It doesn't do anything for me if I can't write my application in Ruby.
 I suppose we could set up some sort of socket-communication between
the Ruby application and Mozilla process, but this seems fragile and
cobbled together.

> The question is how do we describe event handling code in a toolkit
> neutral way (is it even possible)?  I know that in Ruby/FLTK we currently
> make heavy use of blocks in a very Ruby-ish way:

I've come to the conclusion that sockets and signals are the best way
of binding applications to GUIs.  It is the only way that I know of
that separates the control from the view.  Otherwise, you end up with
GUI code in your application, or application code in your GUI, and
neither is very attractive.

>   Fl_Button.new(200,310,45,25, "Finish"){|o|
>     o.callback(""){|o,ud|
>       #rubycode here:
>       #that's all folks
>       cleanup
>       file << report_time
>       file.close
>       exit
>     }
>   }
> 
> In XUL:
> 
>   <button>
>     <description lable="Finish" onclick=Finish()/>
>   </button>


I'd prefer:

The view (XUL):

	<button id='quit' label='_Quit'/>
	<button id='save' label='_Save'/>

The control (Ruby):

	gui.bind( 'quit', app.method( :quit ) )
	gui.bind( 'save' ) { app.save }          # Alternative


> So how do we describe differnt types of code, maybe:
> 
>   <button>
>     <description lable="Finish" />
>       <Ruby_code ...from above.../>
>       <JS_code Finish()/>
>   </button>

I would really, *really* rather not embed code in the XUL, or in any
GUI code whatsoever.  That defeats the whole purpose of XUL, and you
might as well just use a regular embedded GUI API in your application.

Seriously, though... there are (IMO) only two reasons to use XUL:

1) You can run Ruby from Mozilla, so Mozilla is your application
deployment platform, or
2) You can have a clean separation between the model/view/controller.

--- SER