I''ve only had the briefest play with wxSugar and already I like it a lot. One small question - have you considered some more ''convention over configuration'' like they do in rails, in particular for event connectors? So instead of listen(:button, my_button, my_button_pressed) you can leave it out entirely and rely on the convention that a button has a _pressed event (if it exists). Jay Daley
Jay Daley wrote:> I''ve only had the briefest play with wxSugar and already I like it a lot. >Thanks.> One small question - have you considered some more ''convention over > configuration'' like they do in rails, in particular for event connectors? > So instead of > > listen(:button, my_button, my_button_pressed) >Nice suggestion. I''ve been looking at doing something like this with event_connector.rb, inspired in part by flicking through the docs for Dabo[1]. Perhaps declaring a method ''on_button'' should automatically listen for evt_button, and so on. The implementation of this is a little tricky, though. It''s easy to watch out for the methods being added to a class, but harder to intervene cleanly in the instantiation of a widget to actually hook up the event handlers. Also, would need some decisions about which widget''s events to listen for: just self? any child widget? I haven''t used rails much, but I like some of the style, and it''s probably influenced wxSugar. I find some of the rails implementation messy though, and annoying when you try to work with it in not quite the way the authors intended, or not as a suite. With wxSugar I''d like to keep the various behaviours separate, so people can pick and choose, rather than making a big commitment to one WxSugar style. So I''m a bit cautious about intervening initialisers. But it''s partly just a question of a good implementation - eg I rewrote a simple ''ActiveRecord'' that uses mix-ins and define_method rather than inheritance and method_missing - so I''d welcome seeing one for auto-event-connector if anyone fancies having a go. cheers alex [1] http://dabodev.com/
> Nice suggestion.I''m glad you liked it.> I''ve been looking at doing something like this with > event_connector.rb, inspired in part by flicking through the docs for > Dabo[1].That''s a very interesting project, thanks for the link.> Also, would need some decisions about which widget''s > events to listen for: just self? any child widget?I will try and think about that and see if I can come up with any suggestions.> - so I''d welcome seeing one for auto-event-connector if > anyone fancies having a go.Well beyond me I''m afraid. thanks again for taking the suggestion seriously. Jay Daley
Alex Fenton wrote:> Jay Daley wrote: >> I''ve only had the briefest play with wxSugar and already I like it a lot. >> > Thanks. >> One small question - have you considered some more ''convention over >> configuration'' like they do in rails, in particular for event connectors?Like Alex, I have mixed feelings about that approach. It can be great, but can also be limiting.>> So instead of >> >> listen(:button, my_button, my_button_pressed) >> > Nice suggestion. I''ve been looking at doing something like this with > event_connector.rb, inspired in part by flicking through the docs for > Dabo[1]. Perhaps declaring a method ''on_button'' should automatically > listen for evt_button, and so on.I would like to see you use FXRuby for inspiration whenever possible. FX is the dominant cross-platform GUI library for Ruby right now, so the easier it is for folks to migrate from FX to wx the more users we are likely to have. Perhaps at some point we could even has an FX compatibility layer over wx. Not necessarily 100% compatible, but reasonably close. I haven''t even begun to research how feasible that would be. It''s also possible that we could improve on what FX is doing, and they might copy us back, leading toward more compatibility.> With wxSugar I''d like to > keep the various behaviours separate, so people can pick and choose, > rather than making a big commitment to one WxSugar style. So I''m a bit > cautious about intervening initialisers.Sounds good. I need to take a good look at wxSugar sometime. Honestly, I haven''t had a chance yet, which is frustrating. Kevin