diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-03 07:06:51 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 1998-07-03 07:06:51 +0000 |
commit | ab801dbdb7ff8a99b5e0976516b879b27bcf3e1b (patch) | |
tree | 2657a1ca78c166beda5dfb609f9c53c5bae6f85c /lib/tk.rb | |
parent | 1a2003d1f176001f4c691d14a080e722bb12fc7b (diff) |
1.1b9_29
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/v1_1r@260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tk.rb')
-rw-r--r-- | lib/tk.rb | 82 |
1 files changed, 41 insertions, 41 deletions
@@ -284,29 +284,6 @@ module TkComm TkGrid.configure *args end - def after(ms, cmd=Proc.new) - myid = _curr_cmd_id - INTERP._eval('after '+ms+' '+_get_eval_string(install_cmd(proc{ - TkUtil.eval_cmd cmd - uninstall_cmd myid - }))) - return - if false #defined? Thread - Thread.start do - ms = Float(ms)/1000 - ms = 10 if ms == 0 - sleep ms/1000 - cmd.call - end - else - myid = _curr_cmd_id - INTERP._eval('after '+ms+' '+_get_eval_string(install_cmd(proc{ - TkUtil.eval_cmd cmd - uninstall_cmd myid - }))) - end - end - def update(idle=nil) if idle tk_call 'update', 'idletasks' @@ -324,6 +301,24 @@ module TkCore INTERP = TclTkIp.new INTERP._invoke("proc", "rb_out", "args", "ruby [format \"TkCore.callback %%Q!%s!\" $args]") + def after(ms, cmd=Proc.new) + myid = _curr_cmd_id + cmdid = install_cmd(cmd) + tk_call("after",ms,cmdid) + return + if false #defined? Thread + Thread.start do + ms = Float(ms)/1000 + ms = 10 if ms == 0 + sleep ms/1000 + cmd.call + end + else + cmdid = install_cmd(cmd) + tk_call("after",ms,cmdid) + end + end + def TkCore.callback(arg) arg = Array(tk_split_list(arg)) _get_eval_string(TkUtil.eval_cmd(Tk_CMDTBL[arg.shift], *arg)) @@ -1029,13 +1024,12 @@ class TkObject<TkKernel tk_tcl2ruby tk_call path, 'cget', "-#{slot}" end - def configure(slot, value) - if value == FALSE - value = "0" - elsif value.kind_of? Proc - value = install_cmd(value) - end - tk_call path, 'configure', "-#{slot}", value + def configure(slot, value=None) + if slot.kind_of? Hash + tk_call path, 'configure', *hash_kv(slot) + else + tk_call path, 'configure', "-#{slot}", value + end end def configure_cmd(slot, value) @@ -1500,19 +1494,23 @@ module TkComposite end end - def configure(slot, value) - if @delegates and @delegates[slot] - for i in @delegates[slot] - if not i - i = @delegates['DEFALUT'] - redo - else - last = i.configure(slot, value) + def configure(slot, value=None) + if slot.kind_of? Hash + slot.each{|slot,value| configure slot, value} + else + if @delegates and @delegates[slot] + for i in @delegates[slot] + if not i + i = @delegates['DEFALUT'] + redo + else + last = i.configure(slot, value) + end end + last + else + super end - last - else - super end end end @@ -1550,3 +1548,5 @@ autoload :TkEntry, 'tkentry' autoload :TkText, 'tktext' autoload :TkDialog, 'tkdialog' autoload :TkMenubar, 'tkmenubar' +autoload :TkAfter, 'tkafter' +autoload :TkPalette, 'tkpalette' |