summaryrefslogtreecommitdiff
path: root/ext/tk/sample/demos-jp/widget
diff options
context:
space:
mode:
authornagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
committernagai <nagai@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-10-11 04:51:21 +0000
commit3514110b89bee5c37e308b4ca887e66dfe841456 (patch)
treed280d8542cc44d1cd1a75e8ec87b1f9d231561b7 /ext/tk/sample/demos-jp/widget
parent05f5928c9d0f094d1e7e21a9bd9d8a8fc2f1a805 (diff)
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/tk/sample/demos-jp/widget')
-rw-r--r--ext/tk/sample/demos-jp/widget292
1 files changed, 146 insertions, 146 deletions
diff --git a/ext/tk/sample/demos-jp/widget b/ext/tk/sample/demos-jp/widget
index 0544127cbb..e8196aec8f 100644
--- a/ext/tk/sample/demos-jp/widget
+++ b/ext/tk/sample/demos-jp/widget
@@ -28,10 +28,10 @@ when /^4.*/
$font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', nil)
knjfont = '-*--16-*-jisx0208.1983-0'
$kanji_font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*',
- knjfont)
+ knjfont)
TkOption.add('*kanjiFont', knjfont, 'startupFile')
$msg_kanji_font=TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*',
- '-*--24-*-jisx0208.1983-0')
+ '-*--24-*-jisx0208.1983-0')
#when '8.0'
# $font = TkFont.new('Helvetica -12')
@@ -49,10 +49,10 @@ else
$font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*', nil)
knjfont = '-*--16-*-jisx0208.1983-0'
$kanji_font = TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*',
- knjfont)
+ knjfont)
TkOption.add('*kanjiFont', knjfont, 'startupFile')
$msg_kanji_font=TkFont.new('-*-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*',
- '-*--24-*-jisx0208.1983-0')
+ '-*--24-*-jisx0208.1983-0')
end
#######
@@ -117,11 +117,11 @@ end
# メニュー設定
TkMenubar.new($root,
- [[['File', 0],
- ['About ... ', proc{aboutBox}, 0, '<F1>'],
- '---',
- ['Quit', proc{exit}, 0, 'Meta-Q']
- ]]).pack('side'=>'top', 'fill'=>'x')
+ [[['File', 0],
+ ['About ... ', proc{aboutBox}, 0, '<F1>'],
+ '---',
+ ['Quit', proc{exit}, 0, 'Meta-Q']
+ ]]).pack('side'=>'top', 'fill'=>'x')
$root.bind('F1', proc{aboutBox})
$root.bind('Meta-q', proc{exit})
@@ -156,7 +156,7 @@ if $tk_version =~ /^4\.[01]/
else
textFrame = TkFrame.new($root)
scr = TkScrollbar.new($root, 'orient'=>'vertical',
- 'highlightthickness'=>0, 'takefocus'=>1) {
+ 'highlightthickness'=>0, 'takefocus'=>1) {
pack('in'=>textFrame, 'side'=>'right', 'fill'=>'y', 'padx'=>1)
}
txt = TkText.new($root) {
@@ -182,10 +182,10 @@ else
statusBar = TkFrame.new($root) {|f|
$statusBarLabel = \
TkLabel.new(f, 'text'=>" ", 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
- 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \
+ 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \
.pack('side'=>'left', 'padx'=>2, 'expand'=>'yes', 'fill'=>'both')
TkLabel.new(f, 'width'=>8, 'relief'=>'sunken', 'bd'=>1, 'anchor'=>'w',
- 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \
+ 'font'=>'-*-Helvetica-Medium-R-Normal--*-120-*-*-*-*-*-*') \
.pack('side'=>'left', 'padx'=>2)
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>2)
end
@@ -200,53 +200,53 @@ tag_demospace = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c')
if TkWinfo.depth($root) == 1
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
- 'underline'=>1)
+ 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
- 'underline'=>1)
+ 'underline'=>1)
tag_hot = TkTextTag.new(txt, 'background'=>'black', 'foreground'=>'white')
else
tag_demo = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
- 'foreground'=>'blue', 'underline'=>1)
+ 'foreground'=>'blue', 'underline'=>1)
$tag_visited = TkTextTag.new(txt, 'lmargin1'=>'1c', 'lmargin2'=>'1c',
- 'foreground'=>'#303080', 'underline'=>1)
+ 'foreground'=>'#303080', 'underline'=>1)
# tag_hot = TkTextTag.new(txt, 'relief'=>'raised', 'borderwidth'=>1,
-# 'background'=>'SeaGreen3')
+# 'background'=>'SeaGreen3')
tag_hot = TkTextTag.new(txt, 'borderwidth'=>1, 'foreground'=>'red')
end
#tag_demo.bind('Button-1', proc{invoke txt, txt.index('current')})
tag_demo.bind('ButtonRelease-1',
- proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y')
+ proc{|x,y|invoke txt, txt.index("@#{x},#{y}")}, '%x %y')
lastLine = TkVariable.new("")
newLine = TkVariable.new("")
tag_demo.bind('Enter', proc{|x,y|
- lastLine.value = txt.index("@#{x},#{y} linestart")
- tag_hot.add(lastLine.value, "#{lastLine.value} lineend")
- showStatus txt, txt.index("@#{x},#{y}")
- },
- '%x %y')
+ lastLine.value = txt.index("@#{x},#{y} linestart")
+ tag_hot.add(lastLine.value, "#{lastLine.value} lineend")
+ showStatus txt, txt.index("@#{x},#{y}")
+ },
+ '%x %y')
tag_demo.bind('Leave',
- proc{
- tag_hot.remove('1.0','end')
- txt.configure('cursor','xterm')
- $statusBarLabel.configure('text'=>"")
- })
+ proc{
+ tag_hot.remove('1.0','end')
+ txt.configure('cursor','xterm')
+ $statusBarLabel.configure('text'=>"")
+ })
tag_demo.bind('Motion', proc{|x, y|
- newLine.value = txt.index("@#{x},#{y} linestart")
- if newLine.value != lastLine.value
- tag_hot.remove('1.0','end')
- lastLine.value = newLine.value
- if ( txt.tag_names("@#{x},#{y}").find{|t|
- t.kind_of?(String) && t =~ /^demo-/
- } )
- tag_hot.add(lastLine.value,
- "#{lastLine.value} lineend -1 chars")
- end
- end
- showStatus txt, txt.index("@#{x},#{y}")
- },
- '%x %y')
+ newLine.value = txt.index("@#{x},#{y} linestart")
+ if newLine.value != lastLine.value
+ tag_hot.remove('1.0','end')
+ lastLine.value = newLine.value
+ if ( txt.tag_names("@#{x},#{y}").find{|t|
+ t.kind_of?(String) && t =~ /^demo-/
+ } )
+ tag_hot.add(lastLine.value,
+ "#{lastLine.value} lineend -1 chars")
+ end
+ end
+ showStatus txt, txt.index("@#{x},#{y}")
+ },
+ '%x %y')
# テキスト生成
txt.insert('end', 'Ruby/Tk : Widget', tag_title)
@@ -276,47 +276,47 @@ EOT
#txt.insert('end',"ラベル, ボタン, チェックボタン, ラジオボタン\n",tag_middle)
txt.insert('end', "ラベル, ボタン, チェックボタン, ラジオボタン\n",
- tag_kanji_title)
+ tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. ラベル (テキスト, ビットマップ)\n",
- tag_demo, "demo-label")
+ tag_demo, "demo-label")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. ラベルとUNICODEテキスト (機能に対応したバージョンのTkが必要)\n", tag_demo, "demo-unicodeout")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. ボタン \n", tag_demo, "demo-button")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. チェックボタン (複数を選択可能)\n",
- tag_demo, "demo-check")
+ tag_demo, "demo-check")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. 3状態チェックボタン (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-check2")
+ tag_demo, "demo-check2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. ラジオボタン (任意の一つを選択可能)\n",
- tag_demo, "demo-radio")
+ tag_demo, "demo-radio")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "7. ラジオボタン (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-radio2")
+ tag_demo, "demo-radio2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "8. 3状態ラジオボタン (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-radio3")
+ tag_demo, "demo-radio3")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "9. ボタンで作られた15-パズルゲーム\n",
- tag_demo, "demo-puzzle")
+ tag_demo, "demo-puzzle")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "10. ビットマップを使用したアイコンボタン\n",
- tag_demo, "demo-icon")
+ tag_demo, "demo-icon")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "11. 画像を表示する二つのラベル\n",
- tag_demo, "demo-image1")
+ tag_demo, "demo-image1")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "12. 画像を見るための簡単なユーザインターフェース\n",
- tag_demo, "demo-image2")
+ tag_demo, "demo-image2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "13. 画像を見るための簡単なユーザインターフェース (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-image3")
+ tag_demo, "demo-image3")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "14. ラベル付きフレーム (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-labelframe")
+ tag_demo, "demo-labelframe")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
@@ -326,7 +326,7 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 都道府県.\n", tag_demo, "demo-states")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 色: アプリケーションのための配色を変える\n",
- "#{tag_demo.id} demo-colors")
+ "#{tag_demo.id} demo-colors")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 格言集\n", tag_demo, "demo-sayings")
txt.insert('end', " \n ", tag_demospace)
@@ -340,10 +340,10 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. スクロールバーあり\n", tag_demo, "demo-entry2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 認証処理付きのエントリボックスとパスワードフィールド (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-entry3")
+ tag_demo, "demo-entry3")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. スピンボックス (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-spin")
+ tag_demo, "demo-spin")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. 簡単なフォーム\n", tag_demo, "demo-form")
txt.insert('end', " \n ", tag_demospace)
@@ -357,13 +357,13 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 表示スタイル.\n", tag_demo, "demo-style")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. ハイパーテキスト(タグバインド).\n",
- tag_demo, "demo-bind")
+ tag_demo, "demo-bind")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. ウィンドウを埋め込んだテキスト\n",
- tag_demo, "demo-twind")
+ tag_demo, "demo-twind")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "5. ウィンドウを埋め込んだテキスト (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-twind2")
+ tag_demo, "demo-twind2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "6. 検索\n", tag_demo, "demo-search")
txt.insert('end', " \n ", tag_demospace)
@@ -387,7 +387,7 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "7. フロアプラン (異なるキャンバスアイテム作成方法を使用)\n", tag_demo, "demo-floor2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "8. スクロール可能なキャンバス\n",
- tag_demo, "demo-cscroll")
+ tag_demo, "demo-cscroll")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
@@ -403,10 +403,10 @@ txt.insert('end', "\n")
txt.insert('end', "ペインドウィンドウ\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 水平方向 (機能に対応したバージョンのTkが必要)\n",
- tag_demo.id, "demo-paned1")
+ tag_demo.id, "demo-paned1")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. 垂直方向 (機能に対応したバージョンのTkが必要)\n",
- tag_demo.id, "demo-paned2")
+ tag_demo.id, "demo-paned2")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
@@ -414,16 +414,16 @@ txt.insert('end', "\n")
txt.insert('end', "メニュー\n", tag_kanji_title)
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. メニューとカスケードを含んだウィンドウ\n",
- tag_demo, "demo-menu")
+ tag_demo, "demo-menu")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. メニューとカスケードを含んだウィンドウ (Tk8.x 専用)\n",
- tag_demo, "demo-menu8x")
+ tag_demo, "demo-menu8x")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. 〃 (機能に対応したバージョンのTkが必要)\n",
- tag_demo, "demo-menu84")
+ tag_demo, "demo-menu84")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "4. メニューボタン (Tk8.x 専用)\n",
- tag_demo, "demo-menubu")
+ tag_demo, "demo-menubu")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "\n")
@@ -444,10 +444,10 @@ txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "1. 組み込みのビットマップ\n", tag_demo, "demo-bitmap")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "2. モーダルダイアログ(ローカルグラブ)\n",
- tag_demo, "demo-dialog1")
+ tag_demo, "demo-dialog1")
txt.insert('end', " \n ", tag_demospace)
txt.insert('end', "3. モーダルダイアログ(グローバルグラブ)\n",
- tag_demo, "demo-dialog2")
+ tag_demo, "demo-dialog2")
txt.insert('end', " \n ", tag_demospace)
txt.state('disabled')
@@ -483,10 +483,10 @@ def showVars1(parent, *args)
}
args.each{|vnam,vbody|
TkFrame.new(w){|f|
- #TkLabel.new(f, 'text'=>"#{vnam}: ").pack('side'=>'left')
- TkLabel.new(f, 'text'=>"#{vnam}: ",'width'=>len+2).pack('side'=>'left')
- TkLabel.new(f, 'textvariable'=>vbody, 'anchor'=>'w')\
- .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x')
+ #TkLabel.new(f, 'text'=>"#{vnam}: ").pack('side'=>'left')
+ TkLabel.new(f, 'text'=>"#{vnam}: ",'width'=>len+2).pack('side'=>'left')
+ TkLabel.new(f, 'textvariable'=>vbody, 'anchor'=>'w')\
+ .pack('side'=>'left', 'expand'=>'yes', 'fill'=>'x')
}.pack('side'=>'top', 'anchor'=>'w', 'fill'=>'x')
}
TkButton.new(w) {
@@ -508,11 +508,11 @@ def showVars2(parent, *args)
title "Variable values"
TkLabelFrame.new(w, :text=>"変数値:",
- :font=>{:family=>'Helvetica', :size=>14}){|f|
+ :font=>{:family=>'Helvetica', :size=>14}){|f|
args.each{|vnam,vbody|
- TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'),
- TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'),
- :padx=>2, :pady=>2, :sticky=>'w')
+ TkGrid(TkLabel.new(f, :text=>"#{vnam}: ", :anchor=>'w'),
+ TkLabel.new(f, :textvariable=>vbody, :anchor=>'w'),
+ :padx=>2, :pady=>2, :sticky=>'w')
}
f.grid(:sticky=>'news', :padx=>4)
@@ -520,7 +520,7 @@ def showVars2(parent, *args)
f.grid_rowconfig(100, :weight=>1)
}
TkButton.new(w, :text=>"了解", :width=>8, :default=>:active,
- :command=>proc{w.destroy}){|b|
+ :command=>proc{w.destroy}){|b|
w.bind('Return', proc{b.invoke})
w.bind('Escape', proc{b.invoke})
@@ -566,7 +566,7 @@ def showStatus (txt, index)
else
demoname = tag[5..-1]
$statusBarLabel.configure('text',
- "サンプルプログラム \"#{demoname}\" の実行 ")
+ "サンプルプログラム \"#{demoname}\" の実行 ")
newcursor = 'hand2'
end
txt.configure('cursor'=>newcursor) if cursor != newcursor
@@ -583,8 +583,8 @@ def showCode1(demo)
#text "了解"
text "閉じる"
command proc{
- $code_window.destroy
- $code_window = nil
+ $code_window.destroy
+ $code_window = nil
}
}.pack('side'=>'left', 'expand'=>'yes', 'pady'=>2)
TkButton.new(f) {
@@ -597,43 +597,43 @@ def showCode1(demo)
if $tk_version =~ /^4\.[01]/
s = TkScrollbar.new($code_window, 'orient'=>'vertical')
$code_text = TkText.new($code_window) {
- height 40
- setgrid 'yes'
- yscrollcommand proc{|first,last| s.set first,last}
+ height 40
+ setgrid 'yes'
+ yscrollcommand proc{|first,last| s.set first,last}
}
s.command(proc{|*args| $code_text.yview(*args)})
s.pack('side'=>'right', 'fill'=>'y')
$code_text.pack('side'=>'left', 'expand'=>'yes', 'fill'=>'both')
else
TkFrame.new($code_window) {|f|
- pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
-
- hs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
- 'orient'=>'horizontal')
- vs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
- 'orient'=>'vertical')
- $code_text = TkText.new($code_window) {|t|
- height 40
- #wrap 'word'
- wrap 'char'
- xscrollcommand proc{|first,last| hs.set first,last}
- yscrollcommand proc{|first,last| vs.set first,last}
- setgrid 'yes'
- highlightthickness 0
- pady 2
- padx 3
- hs.command(proc{|*args| $code_text.xview(*args)})
- vs.command(proc{|*args| $code_text.yview(*args)})
- }
-
- $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
- 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
- vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
- 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
-# xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
-# 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
- TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
- TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+ pack('expand'=>'yes', 'fill'=>'both', 'padx'=>1, 'pady'=>1)
+
+ hs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
+ 'orient'=>'horizontal')
+ vs = TkScrollbar.new($code_window, 'highlightthickness'=>0,
+ 'orient'=>'vertical')
+ $code_text = TkText.new($code_window) {|t|
+ height 40
+ #wrap 'word'
+ wrap 'char'
+ xscrollcommand proc{|first,last| hs.set first,last}
+ yscrollcommand proc{|first,last| vs.set first,last}
+ setgrid 'yes'
+ highlightthickness 0
+ pady 2
+ padx 3
+ hs.command(proc{|*args| $code_text.xview(*args)})
+ vs.command(proc{|*args| $code_text.yview(*args)})
+ }
+
+ $code_text.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>0,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ vs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>0, 'column'=>1,
+ 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+# xs.grid('in'=>f, 'padx'=>1, 'pady'=>1, 'row'=>1, 'column'=>0,
+# 'rowspan'=>1, 'columnspan'=>1, 'sticky'=>'news')
+ TkGrid.rowconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
+ TkGrid.columnconfigure(f, 0, 'weight'=>1, 'minsize'=>0)
}
end
else
@@ -660,8 +660,8 @@ def showCode2(demo)
$code_window = TkToplevel.new(nil)
tf = TkFrame.new($code_window)
$code_text = TkText.new(tf, :font=>'Courier 10', :height=>30,
- :wrap=>'word', :bd=>1, :setgrid=>true,
- :highlightthickness=>0, :pady=>2, :padx=>3)
+ :wrap=>'word', :bd=>1, :setgrid=>true,
+ :highlightthickness=>0, :pady=>2, :padx=>3)
xscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
yscr = TkScrollbar.new(tf, :bd=>1){assign($code_text)}
TkGrid($code_text, yscr, :sticky=>'news')
@@ -673,17 +673,17 @@ def showCode2(demo)
#b_dis = TkButton.new(bf, :text=>'了解', :default=>:active,
b_dis = TkButton.new(bf, :text=>'閉じる', :default=>:active,
- :command=>proc{
- $code_window.destroy
- $code_window = nil
- },
- :image=>$image['delete'], :compound=>:left)
+ :command=>proc{
+ $code_window.destroy
+ $code_window = nil
+ },
+ :image=>$image['delete'], :compound=>:left)
b_prn = TkButton.new(bf, :text=>'印刷',
- :command=>proc{printCode($code_text, file)},
- :image=>$image['print'], :compound=>:left)
+ :command=>proc{printCode($code_text, file)},
+ :image=>$image['print'], :compound=>:left)
b_run = TkButton.new(bf, :text=>'再実行',
- :command=>proc{eval($code_text.get('1.0','end'))},
- :image=>$image['refresh'], :compound=>:left)
+ :command=>proc{eval($code_text.get('1.0','end'))},
+ :image=>$image['refresh'], :compound=>:left)
TkGrid('x', b_run, b_prn, b_dis, :padx=>4, :pady=>[6,4])
bf.grid_columnconfigure(0, :weight=>1)
@@ -694,8 +694,8 @@ def showCode2(demo)
$code_window.grid_rowconfigure(0, :weight=>1)
$code_window.bind('Return', proc{|win|
- b_dis.invoke unless win.kind_of?(TkText)
- }, '%W')
+ b_dis.invoke unless win.kind_of?(TkText)
+ }, '%W')
$code_window.bindinfo('Return').each{|cmd, arg|
$code_window.bind_append('Escape', cmd, arg)
}
@@ -727,8 +727,8 @@ end
# Much thanks to Arjen Markus for this.
#
# Arguments:
-# txt - Name of text widget containing code to print
-# file - Name of the original file (implicitly for title)
+# txt - Name of text widget containing code to print
+# file - Name of the original file (implicitly for title)
def printCode(txt, file)
code = txt.get('1.0', 'end - 1c')
@@ -744,27 +744,27 @@ def printCode(txt, file)
when 'unix'
msg = `lp -c #{fname}`
unless $?.exitstatus == 0
- Tk.messageBox(:title=>'Print spooling failure',
- :message=>'エラーが発生しました.' +
- '印刷に失敗したものと思われます : ' + msg)
+ Tk.messageBox(:title=>'Print spooling failure',
+ :message=>'エラーが発生しました.' +
+ '印刷に失敗したものと思われます : ' + msg)
end
when 'windows'
begin
- printTextWin32(fname)
+ printTextWin32(fname)
rescue => e
- Tk.messageBox(:title=>'Print spooling failure',
- :message=>'エラーが発生しました.' +
- '印刷に失敗したものと思われます : ' +
- e.message)
+ Tk.messageBox(:title=>'Print spooling failure',
+ :message=>'エラーが発生しました.' +
+ '印刷に失敗したものと思われます : ' +
+ e.message)
end
when 'macintosh'
Tk.messageBox(:title=>'Operation not Implemented',
- :message=>'印刷機能はまだ実装されていません')
+ :message=>'印刷機能はまだ実装されていません')
else
Tk.messageBox(:title=>'Operation not Implemented',
- :message=>'検出された環境 ' +
- Tk::TCL_PLATFORM('platform') +
- ' は未知の環境であるため,' +
+ :message=>'検出された環境 ' +
+ Tk::TCL_PLATFORM('platform') +
+ ' は未知の環境であるため,' +
'印刷機能は実装されていません: ')
end
ensure
@@ -776,7 +776,7 @@ end
# Print a file under Windows
#
# Arguments:
-# filename - Name of the file
+# filename - Name of the file
#
def printTextWin32(fname)
require 'win32/registry'
@@ -807,12 +807,12 @@ end
#
def aboutBox
Tk.messageBox('icon'=>'info', 'type'=>'ok', 'title'=>'About Widget Demo',
- 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.4.3-jp\n\n" +
+ 'message'=>"Ruby/Tk ウィジェットデモ Ver.1.4.3-jp\n\n" +
"based on demos of Tk8.1 -- 8.5 " +
- "( Copyright:: " +
- "(c) 1996-1997 Sun Microsystems, Inc. / " +
+ "( Copyright:: " +
+ "(c) 1996-1997 Sun Microsystems, Inc. / " +
"(c) 1997-2000 Ajuba Solutions, Inc. / " +
- "(c) 2001-2003 Donal K. Fellows )\n\n" +
+ "(c) 2001-2003 Donal K. Fellows )\n\n" +
"Your Ruby & Tk Version ::\n" +
"Ruby#{RUBY_VERSION}(#{RUBY_RELEASE_DATE})[#{RUBY_PLATFORM}] / Tk#{$tk_patchlevel}#{(Tk::JAPANIZED_TK)? '-jp': ''}")
end
@@ -836,7 +836,7 @@ if no_launcher
loop do
count = 0
$root.winfo_children.each{|w|
- count += 1 if w.kind_of?(TkToplevel)
+ count += 1 if w.kind_of?(TkToplevel)
}
$root.destroy if count == 0
end