> > ------< example 2 >------------------------------------------ > > def initialize(...) > > @foo=1234 > > ... > > @root = TkRoot.new() { title "My Form" } > > action_button=TkButton.new(@root, > > :text=>"Action!", > > :command=>proc{ > > puts @foo > > puts @root > > }) > > action_button.pack("side" => "right"); > > end > > Here I have two questions: What is the meaning of the > colon in front of "command", and why can I access @root > now from inside command, but not in my original code? I think, I figured this out by myself: Instead of setting text and command in an initialization procedure for the button, you supply them as parameter (:command denotes the named parameter "command" - I had used only positional parameters before, so I was not aware of this possibility). Since the command procedure is defined inside the list of actual parameters to the TkButton constructor, they can access any variable within the scope of the initialize function body; in particular, they can access the member variables of the surrounding class. Ronald -- Spam protected message from: Sent by mn-pg-p-e-b-consultant-3.com from siemens part of com Posted via http://www.usenet-replayer.com