diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/tk.rb | 18 | ||||
-rw-r--r-- | lib/tkcore.rb | 5 | ||||
-rw-r--r-- | lib/tkthcore.rb | 5 |
3 files changed, 15 insertions, 13 deletions
@@ -486,12 +486,12 @@ class TkLabel<TkWindow tk_call 'label', @path end def textvariable(v) - v = v.id2name unless v.kind_of "String" + v = v.id2name unless v.kind_of? String vn = @path + v - vset = format("global {%s}; set {%s}", vn, vn) - tk_call vset, eval(v).inspect + vset = format("global {%s}; set {%s} %%s", vn, vn) + tk_write vset, eval(v).inspect trace_var v, proc{|val| - tk_call vset, val.inspect + tk_write vset, val.inspect } configure 'textvariable', vn end @@ -520,7 +520,7 @@ class TkRadioButton<TkButton tk_send 'select' end def variable(v) - v = v.id2name unless v.kind_of "String" + v = v.id2name unless v.kind_of? String if v =~ /^\$/ v = $' else @@ -528,13 +528,13 @@ class TkRadioButton<TkButton end vn = 'btns_selected_' + v trace_var v, proc{|val| - tk_call 'set', vn, val + tk_write 'global %s; set %s %s', vn, val } @var_id = install_cmd(proc{|name1,| - val = tk_call('set', name1) + val = tk_call(format('global %s; set', name1), name1) eval(format("%s = '%s'", v.id2name, val)) }) - tk_call 'trace variable', vn, 'w', @var_id + tk_call 'trace', 'variable', vn, 'w', @var_id configure 'variable', vn end def destroy @@ -732,7 +732,7 @@ module TkComposite def delegate(option, *wins) @delegates = {} if not @delegates @delegates['DEFAULT'] = @frame - if option.kind_of? String + if option.kind_of?(String) @delegates[option] = wins else for i in option diff --git a/lib/tkcore.rb b/lib/tkcore.rb index df4af669ba..018e140ef0 100644 --- a/lib/tkcore.rb +++ b/lib/tkcore.rb @@ -185,7 +185,7 @@ after 120000 keepalive' end $tk_event_queue = [] - def tk_call(*args) + def tk_call(str, *args) args = args.collect{|s| next if s == None if s.kind_of?(Hash) @@ -204,7 +204,8 @@ after 120000 keepalive' "{#{s}}" end } - str = args.join(" ") + str += " " + str += args.join(" ") print str, "\n" if $DEBUG tk_write 'rb_ans %s', str while PORT.gets diff --git a/lib/tkthcore.rb b/lib/tkthcore.rb index adbad775d0..5e0abd72c5 100644 --- a/lib/tkthcore.rb +++ b/lib/tkthcore.rb @@ -109,7 +109,7 @@ module Tk val end - def tk_call(*args) + def tk_call(str, *args) Tk.init if $tk_not_init args = args.collect{|s| next if s == None @@ -129,7 +129,8 @@ module Tk "{#{s}}" end } - str = args.join(" ") + str += " " + str += args.join(" ") Qin.push str return Qout.pop end |