From: Meinrad Recheis Date: 2007-03-04T21:04:28+09:00 Subject: Re: Gui Builders for Ruby On 3/2/07, Kyle Schmitt wrote: > This maybe a bit off topic, and is really more of a discussion question but... > > Are there GUI builders for Ruby that allow one to truly divorce the > GUI from the logic? Reading the tutorials for the GUI toolkits, and > the tutorial for foxguib, it appears the idea is make you GUI, then > have your classes inherit the GUI class. Or worse, embed the GUI code > directly into your classes. hi kyle, the foxGUIb docs don't suggest that the application logic classes inherit from the GUI classes! It suggests to extend the GUI class in a subclass or a seperate file by using Ruby's class extension mechanism to seperate manual GUI related code from autogenerated code. Whether you stuff your app's code into the gui class or not is left to you. best practice is like this: mydialog_guib.rb ------ class MyDialog # generated by foxGUIb end mydiaog.rb ----- class MyDialog < MyDialog #connect some event handlers to bind widgets together ... # provide events for the application via Observer Pattern end application.rb ---- # use MyDialog here what you need to do to cleanly decouple gui and application is to use the observer pattern. there is a neat implementation of the Observer Pattern in RAA: Observable by Joel Vanderwarf hope this helps, -- meinrad recheis > > I suppose one good question would be the _right_ way to to make GUIs > for ruby scripts. Really just inheriting the GUI class, making a > separate gui and worker object and glue code between them? > > Admittedly I maybe looking at these tookits a bit naively as I'm just > now writing some front ends to my utility scripts that use on a day in > and day out basis. > > Thanks for any suggestions or comments. > --Kyle > >