diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-08-02 05:04:30 +0000 |
commit | 01d614d05fa34345e9c8e1521684984aaaa05658 (patch) | |
tree | 92b661314bdfd045882e365e3e43b77f57244725 /ext/tk/sample/demos-jp/rmt | |
parent | e3689350394195b3d82013f58a586d5f461cc6b8 (diff) | |
download | ruby-01d614d05fa34345e9c8e1521684984aaaa05658.tar.gz ruby-01d614d05fa34345e9c8e1521684984aaaa05658.tar.xz ruby-01d614d05fa34345e9c8e1521684984aaaa05658.zip |
* (bug fix) TkEntry#delete
* (bug fix) some widget demos
* support <TkVariable object> == <Symbol>
( "coerce TkVariable" add to the TODO list :-) )
* freeze some object for security reason
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@4282 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/rmt')
-rw-r--r-- | ext/tk/sample/demos-jp/rmt | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/ext/tk/sample/demos-jp/rmt b/ext/tk/sample/demos-jp/rmt index 64583d714..73f631180 100644 --- a/ext/tk/sample/demos-jp/rmt +++ b/ext/tk/sample/demos-jp/rmt @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/env ruby # rmt -- # This script implements a simple remote-control mechanism for @@ -53,10 +53,8 @@ class Rmt # Create text window and scrollbar. - @txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) {|t| - TkScrollbar.new(root, 'command'=>proc{|*args| t.yview *args}) { - pack('side'=>'right', 'fill'=>'both') - } + @txt = TkText.new(root, 'relief'=>'sunken', 'bd'=>2, 'setgrid'=>true) { + yscrollbar(TkScrollbar.new(root){pack('side'=>'right', 'fill'=>'y')}) pack('side'=>'left') } @@ -247,13 +245,18 @@ class Rmt rescue end TkWinfo.interps.sort.each{|ip| - if Tk.appsend(ip, false, 'info commands ruby') == "" - mode = 'Tcl' - else - mode = 'Ruby' + begin + if Tk.appsend(ip, false, 'info commands ruby') == "" + mode = 'Tcl' + else + mode = 'Ruby' + end + menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip), + 'command'=>proc{win.newApp ip, mode}) + rescue + menu.add('command', 'label'=>format("%s (unknown Tk)", ip), + 'command'=>proc{win.newApp ip, mode}, 'state'=>'disabled') end - menu.add('command', 'label'=>format("%s (#{mode}/Tk)", ip), - 'command'=>proc{win.newApp ip, mode}) } menu.add('command', 'label'=>format("local (Ruby/Tk)"), 'command'=>proc{win.newApp 'local', 'Ruby'}) |