From: ser@... (Sean Russell) Date: 2004-03-27T10:49:25+09:00 Subject: Re: Ruby,XUL and toolkit agnostic GUIs ptkwt@aracnet.com (Phil Tomson) wrote in message news:... > 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: > > I'd prefer: The view (XUL): 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