From: Gregory Millam Date: 2004-04-08T06:33:10+09:00 Subject: Re: Idea: Simplified GTK Received: Thu, 8 Apr 2004 06:14:18 +0900 And lo, Its wrote: > > Interesting idea. Adding with_context would make it a bit not-so-Ez-Gtk > .... unless we named it ... style? > > or ... with? > with (bindings) { ...} yeah, with() { ... } is better. > > As for :parent in with_context - I believe it'd flow better if it was > automatically placed in the current context parent, like my @storefunc > earlier. > > > > And if one doesn't exist - well, it returns itself, so you can then add it > as per normal > > The same approach works with "with_context". If a binding for :parent is not > found, simply skip the add_child bit (with the current with_context code > this would need a catch()). So I prefer to use a uniform technique. Well I guess it makes sense to do it anyway - even if I wouldn't use it myself, it'd be trivial to add it. One problem with the the whole context thing came into mind, though... def button(label,&block) b = Button.new b.signal_attach("clicked",block) if has_context(:color) ... end if has_context(:bgcolor) ... end if etcetcetc....... Gtk has what, dozens of configurable things? fonts, and the like. end end That would be pretty much done for every single item in EzGtk. Making it considerably slower than: button { color "red" bgcolor "blue" } And ... Don't Gtk+ children inherit attributes from their parents? window { color "red" bgcolor "blue" button { ... } # Button will be red/blue too! } OTOH, EzGtk would really only apply in the creation of widgets, not their runtime, so the only lag (depending on machine speed :D) would be seen when creating windows with lots of widgets.