diff options
Diffstat (limited to 'ext/tk/sample/demos-en/rmt')
-rw-r--r-- | ext/tk/sample/demos-en/rmt | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/ext/tk/sample/demos-en/rmt b/ext/tk/sample/demos-en/rmt index d4b1d93760..73f631180a 100644 --- a/ext/tk/sample/demos-en/rmt +++ b/ext/tk/sample/demos-en/rmt @@ -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'}) |