From: Eli Green Date: 2001-10-26T08:41:59+09:00 Subject: [ruby-talk:23380] Re: GUI / was [ANN] RubyInRubyParser 0.1-pre-alpha > > I never understood why Swing was so slow. I do know, however, that Swing is > > VERY powerful, much more than people realize. Anybody who's ever written a > > Java application with WebObjects will know what I'm talking about. > > > > However, a native Ruby GUI could be just as powerful, and a fair bit sexier! > > > > For example: > > > > window = Window.new > > button = Button.new > > def button.activate > > print "Click!" > > end > > window.add(button) > > window.run > > > > Or something like that. The point is that Ruby has an event model already > > written for us .. just redefine that instance's method! > > An alternative model I played around with involved linking widgets to > WebObjects or IOWA-like property paths (is this how JavaClient works? > Never used it). So a list widget would be bound to table.people, and > would put its selected item into, say, selectedPerson... you would then > have a text input field bound to selectedPerson.firstName, so that when > the selection in the list box changed the field would automatically update > itself. It's a very powerful model, and I implemented a decent version of > it once in Objective-C and Gtk, but it would be cool to see in Ruby as > well. The drawback is that it requires a lot of complex Observer logic to > get all the syncing right. Hmm. MVC, eh? :) I'm not sure the two models are mutually exclusive. Providing both methods would be nice, since people who aren't writing heavily data-driven applications might not mind the singleton method approach, since it'll likely be faster to implement. And I'm not sure the observer would be all that difficult under Ruby. There's probably some pitfall that I'm not thinking of, but it seems relatively straight-forward. > One thing I dislike about using singleton methods is that they don't play > nearly as well with something like Glade or other GUI builders - I prefer > to have more indirection between the view and control layers. > > Actually, thinking about it, what you're describing seems very like > Morphic. Have you looked at Self or Squeak at all? I've played with Squeak a little. -- This will all be on the test. Please study it. Eli Green Codedogs