From: Nathaniel Talbott Date: 2004-04-09T08:17:05+09:00 Subject: Re: Idea: Simplified GTK On Apr 8, 2004, at 14:22, Phil Tomson wrote: > Interesting. I'd be interested in seeing your implementation of setup > and > template. Would that be possible? Wouldn't have to see everything. Well, you're certainly welcome to see it, though I'm not sure how much it will help you: def template(parent) raise "You must call super in initialize!" unless(defined?(@widgets)) @real_parent = parent yield end def setup(name, &block) raise "Invalid widget name #{name}" unless(@widgets[name]) @widgets[name].setup(&block) end One thing that is key to the implementation is that I don't manipulate the real Fox widgets... instead, I wrap each one that I use and the final widgets only get built when I call build at the end of the create method. Here's the implementation for one widget wrapper: class TextField < Widget widget_attr :columns_visible => 1 widget_attr :options => TEXTFIELD_NORMAL|LAYOUT_FILL_X widget_event :on_change, SEL_CHANGED widget_event :on_keypress, SEL_KEYPRESS def do_build(real_parent) FXTextField::new(real_parent, @columns_visible, nil, 0, @options) end end Probably all I've really done is to tease you more... at some point I would like to release the utility, but I'm not doing Ruby much right now (new Java contract) so it may be a little while. HTH, Nathaniel Terralien, Inc. <:((><