Hi, 

From: "Joachim Wuttke" <wuttke1 / web.de>
Subject: how to escape variable expansion in a block
Date: Mon, 4 Oct 2004 05:33:09 +0900
Message-ID: <859363546 / web.de>
>         this = self # <- this is ugly, though it solves the problem
>         TkButton.new( frame ) {
>             text 'press here'
>             command proc { this.buttonPressed } # <- here is the problem
>         }

Solution-1:
  btn_callback = proc{ buttonPressed }
  TkButton.new(frame){
    text 'press here'
    command btn_callback
  }

Solution-2:
  b = TkButton.new(frame){text 'press here'}
  b.command{ buttonPressed }

Solution-3: 
  TkButton.new(frame).text('press here').command{ buttonPressed }

Solution-4: 
  TkButton.new(frame){
    text 'press here'
  }.command{ buttonPressed }

Solution-5:
  TkButton.new(frame, :text=>'press here', :command=>proc{ buttonPressed })

Solution-6:
  TkButton.new(frame, :command=>proc{ buttonPressed }){ text 'press here' }

and so on.
Please select the one which you like. :-)

# If I were you, I'll choose 'Solution-5'.
-- 
                                  Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)