From: Gregory Millam Date: 2004-04-08T05:54:16+09:00 Subject: Re: Idea: Simplified GTK Received: Thu, 8 Apr 2004 05:29:17 +0900 And lo, Its wrote: > Perhaps we could uniformly do everything with: > > widget_name { block } > > We could wrap dynamically scoped variables around these calls. Within any of > the methods (widget_name above, or below: button, label, command, color, > vbox) we can look up dynamically scoped variables with find_in_context > (:var), or set up further (nested) scopes of variables with > with_context(:var=>...). > > with_context (:parent=>a_container) { > button { > label "Label" > command { block } > color "green" > } > vbox { > with_context(:color=>"purple") { > button {...} > hbox {...} > } > } Interesting idea. Adding with_context would make it a bit not-so-Ez-Gtk ... unless we named it ... style? style(:color=>"yellow",:bgcolor=>"purple") { window { label "Barney loves you ... Run!" } } - and style returns whatever returns in its yield. 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 myvbox = style("...") { vbox { ... } } mywindow.add myvbox - Greg Millam