diff options
author | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-01 16:09:54 +0000 |
---|---|---|
committer | nagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-01 16:09:54 +0000 |
commit | 4c4631c2daaf7b2418c1f0e39292c8ee27a64813 (patch) | |
tree | dfeb96c4772df8caba4e01e749c8f3e1262f8fe0 /ext/tk/sample/demos-en/search.rb | |
parent | ce23680755e4e9ab0eed9dc6adb091ef7f1c58cb (diff) | |
download | ruby-4c4631c2daaf7b2418c1f0e39292c8ee27a64813.tar.gz |
* renewal Ruby/Tk
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-en/search.rb')
-rw-r--r-- | ext/tk/sample/demos-en/search.rb | 42 |
1 files changed, 15 insertions, 27 deletions
diff --git a/ext/tk/sample/demos-en/search.rb b/ext/tk/sample/demos-en/search.rb index 2b27cdbb42..59a8117bb7 100644 --- a/ext/tk/sample/demos-en/search.rb +++ b/ext/tk/sample/demos-en/search.rb @@ -133,7 +133,7 @@ TkFrame.new($search_demo) {|f| } }.pack('side'=>'top', 'fill'=>'x') -$search_text = TkText.new($search_demo, 'setgrid'=>true) {|t| +$search_text = TkText.new($search_demo, 'setgrid'=>true, 'wrap'=>'word') {|t| $search_Tag = TkTextTag.new(t) TkScrollbar.new($search_demo, 'command'=>proc{|*args| t.yview(*args)}) {|sc| t.yscrollcommand(proc{|first,last| sc.set first,last}) @@ -146,45 +146,33 @@ $search_text = TkText.new($search_demo, 'setgrid'=>true) {|t| if TkWinfo.depth($search_demo) > 1 textToggle(proc{ - begin - $search_Tag.configure('background'=>'#ce5555', - 'foreground'=>'white') - rescue - end + $search_Tag.configure('background'=>'#ce5555', + 'foreground'=>'white') }, 800, proc{ - begin - $search_Tag.configure('background'=>'', 'foreground'=>'') - rescue - end + $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) else textToggle(proc{ - begin - $search_Tag.configure('background'=>'black', - 'foreground'=>'white') - rescue - end + $search_Tag.configure('background'=>'black', + 'foreground'=>'white') }, 800, proc{ - begin - $search_Tag.configure('background'=>'', 'foreground'=>'') - rescue - end + $search_Tag.configure('background'=>'', 'foreground'=>'') }, 200 ) end -$search_text.insert('1.0', '\ -This window demonstrates how to use the tagging facilities in text -widgets to implement a searching mechanism. First, type a file name -in the top entry, then type <Return> or click on "Load File". Then -type a string in the lower entry and type <Return> or click on -"Load File". This will cause all of the instances of the string to -be tagged with the tag "search", and it will arrange for the tag\'s -display attributes to change to make all of the strings blink.') +$search_text.insert('1.0', "\ +This window demonstrates how to use the tagging facilities in text \ +widgets to implement a searching mechanism. First, type a file name \ +in the top entry, then type <Return> or click on \"Load File\". Then \ +type a string in the lower entry and type <Return> or click on \ +\"Load File\". This will cause all of the instances of the string to \ +be tagged with the tag \"search\", and it will arrange for the tag\'s \ +display attributes to change to make all of the strings blink.") $search_text.set_insert '0.0' $search_fileName.value = '' |