summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-30 07:15:00 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-07-30 07:15:00 +0000
commit4e0bb56f210c245e5208ae4ca12e8597b1ff64af (patch)
treed933554bf3086ff89f359a5489a7b5aea61b304f /ext
parent029e9449ce7fa4710eac7a66e605afb3dc8a99ce (diff)
* bug fix
* fix lack of methods for TkEntry * fix reference of uninitialized variables git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/tk/lib/multi-tk.rb1
-rw-r--r--ext/tk/lib/tk.rb5
-rw-r--r--ext/tk/lib/tkdialog.rb4
-rw-r--r--ext/tk/lib/tkentry.rb7
-rw-r--r--ext/tk/sample/safe-tk.rb18
-rw-r--r--ext/tk/sample/tktimer2.rb4
6 files changed, 33 insertions, 6 deletions
diff --git a/ext/tk/lib/multi-tk.rb b/ext/tk/lib/multi-tk.rb
index 00d0182..06d21d2 100644
--- a/ext/tk/lib/multi-tk.rb
+++ b/ext/tk/lib/multi-tk.rb
@@ -27,6 +27,7 @@ MultiTkIp_OK.freeze
class MultiTkIp
# ignore exception on the mainloop
+ #TclTkLib.mainloop_abort_on_exception = false
TclTkLib.mainloop_abort_on_exception = nil
######################################
diff --git a/ext/tk/lib/tk.rb b/ext/tk/lib/tk.rb
index 13e41ec..7b7b116 100644
--- a/ext/tk/lib/tk.rb
+++ b/ext/tk/lib/tk.rb
@@ -1693,6 +1693,11 @@ class TkVariable
@id = Tk_VARIABLE_ID.join
Tk_VARIABLE_ID[1].succ!
TkVar_ID_TBL[@id] = self
+
+ @trace_var = nil
+ @trace_elem = nil
+ @trace_opts = nil
+
if val == []
INTERP._eval(format('global %s; set %s(0) 0; unset %s(0)',
@id, @id, @id))
diff --git a/ext/tk/lib/tkdialog.rb b/ext/tk/lib/tkdialog.rb
index b15b794..febe470 100644
--- a/ext/tk/lib/tkdialog.rb
+++ b/ext/tk/lib/tkdialog.rb
@@ -57,6 +57,7 @@ class TkDialog2 < TkWindow
@message = message
@message_config = message_config
+ @msgframe_config = msgframe_config
@bitmap = bitmap
@bitmap_config = message_config
@@ -65,10 +66,13 @@ class TkDialog2 < TkWindow
@buttons = buttons
@button_configs = proc{|num| button_configs(num)}
+ @btnframe_config = btnframe_config
#@config = "puts [winfo children .w0000];"
@config = ""
+ @command = nil
+
if keys.kind_of? Hash
keys = _symbolkey2str(keys)
@title = keys['title'] if keys.key? 'title'
diff --git a/ext/tk/lib/tkentry.rb b/ext/tk/lib/tkentry.rb
index 62b6535..ccfb792 100644
--- a/ext/tk/lib/tkentry.rb
+++ b/ext/tk/lib/tkentry.rb
@@ -140,6 +140,9 @@ class TkEntry<TkLabel
self
end
+ def bbox(index)
+ list(tk_send('bbox', index))
+ end
def cursor
number(tk_send('index', 'insert'))
end
@@ -154,6 +157,10 @@ class TkEntry<TkLabel
tk_send 'insert', pos, text
self
end
+ def delete(first, last=None)
+ tk_send 'insert', first, last
+ self
+ end
def mark(pos)
tk_send 'scan', 'mark', pos
self
diff --git a/ext/tk/sample/safe-tk.rb b/ext/tk/sample/safe-tk.rb
index 7050b23..90eb456 100644
--- a/ext/tk/sample/safe-tk.rb
+++ b/ext/tk/sample/safe-tk.rb
@@ -14,11 +14,13 @@ safe_slave2 = MultiTkIp.new_safeTk('fill'=>:none, 'expand'=>false)
cmd = Proc.new{|txt|
#####################
## from TkTimer2.rb
- begin
- root = TkRoot.new(:title=>'timer sample')
- rescue
+
+ if TkCore::INTERP.safe?
# safeTk doesn't have permission to call 'wm' command
+ else
+ root = TkRoot.new(:title=>'timer sample')
end
+
label = TkLabel.new(:parent=>root, :relief=>:raised, :width=>10) \
.pack(:side=>:bottom, :fill=>:both)
@@ -34,6 +36,10 @@ cmd = Proc.new{|txt|
command proc{ timer.continue unless timer.running? }
pack(:side=>:left, :fill=>:both, :expand=>true)
}
+ TkButton.new(:text=>'Restart') {
+ command proc{ timer.restart(0, proc{ label.text('0.00'); 0 }) }
+ pack('side'=>'right','fill'=>'both','expand'=>'yes')
+ }
TkButton.new(:text=>'Stop') {
command proc{ timer.stop if timer.running? }
pack('side'=>'right','fill'=>'both','expand'=>'yes')
@@ -45,9 +51,9 @@ cmd = Proc.new{|txt|
# call on the default master interpreter
trusted_slave.eval_proc(cmd, 'trusted') # label -> .w00012
-safe_slave1.eval_proc(cmd, 'safe1') # label -> .w00015
-safe_slave2.eval_proc(cmd, 'safe2') # label -> .w00018
-cmd.call('master') # label -> .w00021
+safe_slave1.eval_proc(cmd, 'safe1') # label -> .w00016
+safe_slave2.eval_proc(cmd, 'safe2') # label -> .w00020
+cmd.call('master') # label -> .w00024
TkTimer.new(2000, -1, proc{p ['safe1', safe_slave1.deleted?]}).start
TkTimer.new(2000, -1, proc{p ['safe2', safe_slave2.deleted?]}).start
diff --git a/ext/tk/sample/tktimer2.rb b/ext/tk/sample/tktimer2.rb
index dc4e8a6..dd31bb0 100644
--- a/ext/tk/sample/tktimer2.rb
+++ b/ext/tk/sample/tktimer2.rb
@@ -32,6 +32,10 @@ TkButton.new(:text=>'Start') {
command proc{ timer.continue unless timer.running? }
pack(:side=>:left, :fill=>:both, :expand=>true)
}
+TkButton.new(:text=>'Restart') {
+ command proc{ timer.restart(0, proc{ label.text('0.00'); 0 }) }
+ pack(:side=>:left, :fill=>:both, :expand=>true)
+}
TkButton.new(:text=>'Stop') {
command proc{ timer.stop if timer.running? }
pack('side'=>'right','fill'=>'both','expand'=>'yes')