Method: Test1#test_button
- Defined in:
- sample/tcltklib/sample1.rb
#test_button(ip, parent) ⇒ Object
button のサンプル.
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'sample/tcltklib/sample1.rb', line 275 def (ip, parent) , pack = ip.commands().values_at("button", "pack") t1, b1, cb = inittoplevel(ip, parent, "button") ## button # コールバック内で参照する変数は先に宣言しておかなければならない. b3 = b4 = nil cb.push(c = TclTkCallback.new(ip, proc{b3.e("flash"); b4.e("flash")})) b2 = TclTkWidget.new(ip, t1, , "-text flash -command", c) cb.push(c = TclTkCallback.new(ip, proc{b2.e("configure -state normal")})) b3 = TclTkWidget.new(ip, t1, , "-text normal -command", c) cb.push(c = TclTkCallback.new(ip, proc{b2.e("configure -state disabled")})) b4 = TclTkWidget.new(ip, t1, , "-text disable -command", c) pack.e(b1, b2, b3, b4) end |