diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-08 06:23:41 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-09-08 06:23:41 +0000 |
commit | 38bbb9673fc0fb69f890e8675d910eea646350f7 (patch) | |
tree | c50e8744a4c5ee877f4740dbb6f796b3f449e5aa /ext/tk/lib/tk | |
parent | 23a48713683a2f03bc8bb619f1fa62765658f6b7 (diff) |
* ext/tcltklib/tcltklib.c (ip_init): cannot create a IP at level 4
* ext/tk/lib/multi-tk.rb: improve 'exit' operation, security check, and error treatment
* ext/tk/lib/multi-tk.rb: allow a trusted slave IP to create slave IPs.
* ext/tk/lib/tk/listbox.rb: add TkListbox#value, value=, clear, and erase
* ext/tk/lib/tk/text.rb: add TkText#clear and erase
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6871 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/lib/tk')
-rw-r--r-- | ext/tk/lib/tk/listbox.rb | 20 | ||||
-rw-r--r-- | ext/tk/lib/tk/text.rb | 6 |
2 files changed, 26 insertions, 0 deletions
diff --git a/ext/tk/lib/tk/listbox.rb b/ext/tk/lib/tk/listbox.rb index 70df0ad685..d642ba2f09 100644 --- a/ext/tk/lib/tk/listbox.rb +++ b/ext/tk/lib/tk/listbox.rb @@ -77,6 +77,26 @@ class TkListbox<TkTextWin tk_send_without_enc('index', index).to_i end + def value + get('0', 'end') + end + + def value= (vals) + unless vals.kind_of?(Array) + fail ArgumentError, 'an Array is expected' + end + tk_send_without_enc('delete', '0', 'end') + tk_send_without_enc('insert', '0', + *(vals.collect{|v| _get_eval_enc_str(v)})) + vals + end + + def clear + tk_send_without_enc('delete', '0', 'end') + self + end + alias erase clear + =begin def itemcget(index, key) case key.to_s diff --git a/ext/tk/lib/tk/text.rb b/ext/tk/lib/tk/text.rb index acdc905fe0..c05e3f03ad 100644 --- a/ext/tk/lib/tk/text.rb +++ b/ext/tk/lib/tk/text.rb @@ -120,6 +120,12 @@ class TkText<TkTextWin val end + def clear + tk_send_without_enc('delete', "1.0", 'end') + self + end + alias erase clear + def _addcmd(cmd) @cmdtbl.push cmd end |