mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/tk/lib/tk/*: untabify
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
05f5928c9d
commit
3514110b89
296 changed files with 13591 additions and 13558 deletions
|
|
@ -3,8 +3,8 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
Tk::Iwidgets::Calendar.new(:command=>proc{|arg| puts(arg.date)},
|
||||
:weekendbackground=>'mistyrose',
|
||||
:weekdaybackground=>'ghostwhite',
|
||||
:outline=>'black', :startday=>'wednesday',
|
||||
:days=>%w(We Th Fr Sa Su Mo Tu)).pack
|
||||
:weekendbackground=>'mistyrose',
|
||||
:weekdaybackground=>'ghostwhite',
|
||||
:outline=>'black', :startday=>'wednesday',
|
||||
:days=>%w(We Th Fr Sa Su Mo Tu)).pack
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ require 'tkextlib/iwidgets'
|
|||
# Non-editable Dropdown Combobox
|
||||
#
|
||||
cb1 = Tk::Iwidgets::Combobox.new(:labeltext=>'Month:',
|
||||
:selectioncommand=>proc{
|
||||
puts(cb1.get_curselection)
|
||||
},
|
||||
:editable=>false, :listheight=>185,
|
||||
:popupcursor=>'hand1')
|
||||
:selectioncommand=>proc{
|
||||
puts(cb1.get_curselection)
|
||||
},
|
||||
:editable=>false, :listheight=>185,
|
||||
:popupcursor=>'hand1')
|
||||
|
||||
cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec))
|
||||
|
||||
|
|
@ -19,9 +19,9 @@ cb1.insert_list('end', *%w(Jan Feb Mar Apr May June Jul Aug Sept Oct Nov Dec))
|
|||
# Editable Dropdown Combobox
|
||||
#
|
||||
cb2 = Tk::Iwidgets::Combobox.new(:labeltext=>'Operating System:',
|
||||
:selectioncommand=>proc{
|
||||
puts(cb2.get_curselection)
|
||||
})
|
||||
:selectioncommand=>proc{
|
||||
puts(cb2.get_curselection)
|
||||
})
|
||||
|
||||
cb2.insert_list('end', *%w(Linux HP-UX SunOS Solaris Irix))
|
||||
cb2.insert_entry('end', 'L')
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ ds.add('Cancel', :text=>'Cancel', :command=>proc{puts 'Cancel'; ds.deactivate})
|
|||
ds.default('OK')
|
||||
|
||||
TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
|
||||
:command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10)
|
||||
:command=>proc{puts ds.activate}).pack(:padx=>10, :pady=>10)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
djl = Tk::Iwidgets::Disjointlistbox.new.pack(:fill=>:both, :expand=>true,
|
||||
:padx=>10, :pady=>10)
|
||||
:padx=>10, :pady=>10)
|
||||
djl.set_lhs(*[0,2,4,5])
|
||||
djl.set_rhs(3,6)
|
||||
|
||||
|
|
|
|||
|
|
@ -12,21 +12,21 @@ TkOption.add('*textBackground', 'white')
|
|||
ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
|
||||
|
||||
fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
|
||||
:fixed=>10, :width=>12)
|
||||
:fixed=>10, :width=>12)
|
||||
|
||||
nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
|
||||
:validate=>:numeric, :width=>12)
|
||||
:validate=>:numeric, :width=>12)
|
||||
|
||||
aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
|
||||
pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
|
||||
:show=>Tk::UTF8_String("\267"),
|
||||
## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
:show=>Tk::UTF8_String("\267"),
|
||||
## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
|
||||
Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,20 @@ TkOption.add('*textBackground', 'white')
|
|||
ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
|
||||
|
||||
fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
|
||||
:fixed=>10, :width=>12)
|
||||
:fixed=>10, :width=>12)
|
||||
|
||||
nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
|
||||
:validate=>:numeric, :width=>12)
|
||||
:validate=>:numeric, :width=>12)
|
||||
|
||||
aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
|
||||
pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
|
||||
:show=>"\267", ## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
:show=>"\267", ## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
|
||||
Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,20 +14,20 @@ TkOption.add('*textBackground', 'white')
|
|||
ef = Tk::Iwidgets::Entryfield.new(:command=>proc{puts "Return Pressed"})
|
||||
|
||||
fef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Fixed:',
|
||||
:fixed=>10, :width=>12)
|
||||
:fixed=>10, :width=>12)
|
||||
|
||||
nef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Numeric:',
|
||||
:validate=>:numeric, :width=>12)
|
||||
:validate=>:numeric, :width=>12)
|
||||
|
||||
aef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Alphabetic:',
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
:validate=>:alphabetic, :width=>12,
|
||||
:invalid=>proc{
|
||||
puts "Alphabetic contents invalid"
|
||||
})
|
||||
|
||||
pef = Tk::Iwidgets::Entryfield.new(:labeltext=>'Password:', :width=>12,
|
||||
:show=>"\267", ## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
:show=>"\267", ## <=== utf8 character
|
||||
:command=>proc{puts "Return Pressed"})
|
||||
|
||||
Tk::Iwidgets::Labeledwidget.alignlabels(ef, fef, nef, aef, pef)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,18 +3,18 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
Tk::Iwidgets::Extbutton.new(:text=>'Bitmap example', :bitmap=>'info',
|
||||
:background=>'bisque', :activeforeground=>'red',
|
||||
:bitmapforeground=>'blue', :defaultring=>true,
|
||||
:command=>proc{
|
||||
puts "Bisque is beautiful"
|
||||
}).pack(:expand=>true)
|
||||
:background=>'bisque', :activeforeground=>'red',
|
||||
:bitmapforeground=>'blue', :defaultring=>true,
|
||||
:command=>proc{
|
||||
puts "Bisque is beautiful"
|
||||
}).pack(:expand=>true)
|
||||
|
||||
#img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../../../images/earthris.gif'))
|
||||
img = TkPhotoImage.new(:file=>File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/clear.gif'))
|
||||
|
||||
Tk::Iwidgets::Extbutton.new(:text=>'Image example', :relief=>:ridge,
|
||||
:image=>img, :imagepos=>:e, :font=>'9x15bold',
|
||||
:activebackground=>'lightyellow',
|
||||
:background=>'lightgreen').pack(:expand=>true)
|
||||
:image=>img, :imagepos=>:e, :font=>'9x15bold',
|
||||
:activebackground=>'lightyellow',
|
||||
:background=>'lightgreen').pack(:expand=>true)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
Tk::Iwidgets::Extfileselectionbox.new.pack(:padx=>10, :pady=>10,
|
||||
:fill=>:both, :expand=>true)
|
||||
:fill=>:both, :expand=>true)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ mainloop = Thread.new{Tk.mainloop}
|
|||
#
|
||||
nmfsd = Tk::Iwidgets::Extfileselectiondialog.new(:title=>'Non-Modal')
|
||||
nmfsd.buttonconfigure('OK', :command=>proc{
|
||||
puts "You selected #{nmfsd.get}"
|
||||
nmfsd.deactivate
|
||||
})
|
||||
puts "You selected #{nmfsd.get}"
|
||||
nmfsd.deactivate
|
||||
})
|
||||
nmfsd.activate
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -3,6 +3,6 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
Tk::Iwidgets::Fileselectionbox.new.pack(:padx=>10, :pady=>10,
|
||||
:fill=>:both, :expand=>true)
|
||||
:fill=>:both, :expand=>true)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ mainloop = Thread.new{Tk.mainloop}
|
|||
#
|
||||
nmfsd = Tk::Iwidgets::Fileselectiondialog.new(:title=>'Non-Modal')
|
||||
nmfsd.buttonconfigure('OK', :command=>proc{
|
||||
puts "You selected #{nmfsd.get}"
|
||||
nmfsd.deactivate
|
||||
})
|
||||
puts "You selected #{nmfsd.get}"
|
||||
nmfsd.deactivate
|
||||
})
|
||||
nmfsd.activate
|
||||
|
||||
#
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ def get_files(file)
|
|||
end
|
||||
|
||||
Tk::Iwidgets::Hierarchy.new(:querycommand=>proc{|arg| get_files(arg.node)},
|
||||
:visibleitems=>'30x15',
|
||||
:labeltext=>ENV['HOME']).pack(:side=>:left,
|
||||
:expand=>true,
|
||||
:fill=>:both)
|
||||
:visibleitems=>'30x15',
|
||||
:labeltext=>ENV['HOME']).pack(:side=>:left,
|
||||
:expand=>true,
|
||||
:fill=>:both)
|
||||
|
||||
# Tk::Iwidgets::Hierarchy.new(:querycommand=>[proc{|n| get_files(n)}, '%n'],
|
||||
# :visibleitems=>'30x15',
|
||||
# :labeltext=>ENV['HOME']).pack(:side=>:left,
|
||||
# :expand=>true,
|
||||
# :fill=>:both)
|
||||
# :visibleitems=>'30x15',
|
||||
# :labeltext=>ENV['HOME']).pack(:side=>:left,
|
||||
# :expand=>true,
|
||||
# :fill=>:both)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
lw = Tk::Iwidgets::Labeledwidget.new(:labeltext=>'Canvas Widget',
|
||||
:labelpos=>:s)
|
||||
:labelpos=>:s)
|
||||
lw.pack(:fill=>:both, :expand=>true, :padx=>10, :pady=>10)
|
||||
|
||||
cw = TkCanvas.new(lw.child_site, :relief=>:raised, :width=>200, :height=>200,
|
||||
:borderwidth=>3, :background=>:white)
|
||||
:borderwidth=>3, :background=>:white)
|
||||
cw.pack(:padx=>10, :pady=>10)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -5,57 +5,57 @@ require 'tkextlib/iwidgets'
|
|||
mw = Tk::Iwidgets::Mainwindow.new
|
||||
|
||||
mw.menubar.add(:menubutton, 'file', :text=>'File', :underline=>0,
|
||||
:padx=>8, :pady=>2, :menu=>[
|
||||
[:options, {:tearoff=>false}],
|
||||
:padx=>8, :pady=>2, :menu=>[
|
||||
[:options, {:tearoff=>false}],
|
||||
|
||||
[:command, 'new', {
|
||||
:label=>'New', :underline=>0,
|
||||
:helpstr=>'Create a new file'
|
||||
}
|
||||
],
|
||||
[:command, 'new', {
|
||||
:label=>'New', :underline=>0,
|
||||
:helpstr=>'Create a new file'
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'open', {
|
||||
:label=>'Open ...', :underline=>0,
|
||||
:helpstr=>'Open an existing file'
|
||||
}
|
||||
],
|
||||
[:command, 'open', {
|
||||
:label=>'Open ...', :underline=>0,
|
||||
:helpstr=>'Open an existing file'
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'save', {
|
||||
:label=>'Save', :underline=>0,
|
||||
:helpstr=>'Save the current file'
|
||||
}
|
||||
],
|
||||
[:command, 'save', {
|
||||
:label=>'Save', :underline=>0,
|
||||
:helpstr=>'Save the current file'
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'saveas', {
|
||||
:label=>'Save As', :underline=>5,
|
||||
:helpstr=>'Save the file as a different name'
|
||||
}
|
||||
],
|
||||
[:command, 'saveas', {
|
||||
:label=>'Save As', :underline=>5,
|
||||
:helpstr=>'Save the file as a different name'
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'print', {
|
||||
:label=>'Print', :underline=>0,
|
||||
:helpstr=>'Print the file'
|
||||
}
|
||||
],
|
||||
[:command, 'print', {
|
||||
:label=>'Print', :underline=>0,
|
||||
:helpstr=>'Print the file'
|
||||
}
|
||||
],
|
||||
|
||||
[:separator, 'sep1'],
|
||||
[:separator, 'sep1'],
|
||||
|
||||
[:command, 'close', {
|
||||
:label=>'Close', :underline=>0,
|
||||
:helpstr=>'Close the file'
|
||||
}
|
||||
],
|
||||
[:command, 'close', {
|
||||
:label=>'Close', :underline=>0,
|
||||
:helpstr=>'Close the file'
|
||||
}
|
||||
],
|
||||
|
||||
[:separator, 'sep2'],
|
||||
[:separator, 'sep2'],
|
||||
|
||||
[:command, 'exit', {
|
||||
:label=>'Exit', :underline=>1,
|
||||
:helpstr=>'Exit this application'
|
||||
}
|
||||
],
|
||||
[:command, 'exit', {
|
||||
:label=>'Exit', :underline=>1,
|
||||
:helpstr=>'Exit this application'
|
||||
}
|
||||
],
|
||||
|
||||
nil
|
||||
])
|
||||
nil
|
||||
])
|
||||
|
||||
Tk::Iwidgets::Scrolledtext.new(mw.child_site).pack(:fill=>:both, :expand=>true)
|
||||
|
||||
|
|
|
|||
|
|
@ -8,109 +8,109 @@ viewmode = TkVariable.new
|
|||
menu_spec = [
|
||||
[:menubutton, 'file', {
|
||||
:text=>'File', :menu=>[
|
||||
[:options, {:tearoff=>false}],
|
||||
[:options, {:tearoff=>false}],
|
||||
|
||||
[:command, 'new', {
|
||||
:label=>'New', :helpstr=>'Open new document',
|
||||
:command=>proc{puts 'NEW'}
|
||||
}
|
||||
],
|
||||
[:command, 'new', {
|
||||
:label=>'New', :helpstr=>'Open new document',
|
||||
:command=>proc{puts 'NEW'}
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'close', {
|
||||
:label=>'Close', :helpstr=>'Close current document',
|
||||
:command=>proc{puts 'CLOSE'}
|
||||
}
|
||||
],
|
||||
[:command, 'close', {
|
||||
:label=>'Close', :helpstr=>'Close current document',
|
||||
:command=>proc{puts 'CLOSE'}
|
||||
}
|
||||
],
|
||||
|
||||
[:separator, 'sep1'],
|
||||
[:separator, 'sep1'],
|
||||
|
||||
[:command, 'exit', {
|
||||
:label=>'Exit', :helpstr=>'Exit application',
|
||||
:command=>proc{exit}
|
||||
}
|
||||
]
|
||||
[:command, 'exit', {
|
||||
:label=>'Exit', :helpstr=>'Exit application',
|
||||
:command=>proc{exit}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
[:menubutton, 'edit', {
|
||||
:text=>'Edit', :menu=>[
|
||||
[:options, {:tearoff=>false}],
|
||||
[:options, {:tearoff=>false}],
|
||||
|
||||
[:command, 'undo', {
|
||||
:label=>'Undo', :underline=>0,
|
||||
:helpstr=>'Undo last command',
|
||||
:command=>proc{puts 'UNDO'}
|
||||
}
|
||||
],
|
||||
[:command, 'undo', {
|
||||
:label=>'Undo', :underline=>0,
|
||||
:helpstr=>'Undo last command',
|
||||
:command=>proc{puts 'UNDO'}
|
||||
}
|
||||
],
|
||||
|
||||
[:separator, 'sep2'],
|
||||
[:separator, 'sep2'],
|
||||
|
||||
[:command, 'cut', {
|
||||
:label=>'Cut', :underline=>1,
|
||||
:helpstr=>'Cut selection to clipboard',
|
||||
:command=>proc{puts 'CUT'}
|
||||
}
|
||||
],
|
||||
[:command, 'cut', {
|
||||
:label=>'Cut', :underline=>1,
|
||||
:helpstr=>'Cut selection to clipboard',
|
||||
:command=>proc{puts 'CUT'}
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'copy', {
|
||||
:label=>'Copy', :underline=>1,
|
||||
:helpstr=>'Copy selection to clipboard',
|
||||
:command=>proc{puts 'COPY'}
|
||||
}
|
||||
],
|
||||
[:command, 'copy', {
|
||||
:label=>'Copy', :underline=>1,
|
||||
:helpstr=>'Copy selection to clipboard',
|
||||
:command=>proc{puts 'COPY'}
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'paste', {
|
||||
:label=>'Paste', :underline=>0,
|
||||
:helpstr=>'Paste clipboard contents',
|
||||
:command=>proc{puts 'PASTE'}
|
||||
}
|
||||
]
|
||||
[:command, 'paste', {
|
||||
:label=>'Paste', :underline=>0,
|
||||
:helpstr=>'Paste clipboard contents',
|
||||
:command=>proc{puts 'PASTE'}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
[:menubutton, 'options', {
|
||||
:text=>'Options', :menu=>[
|
||||
[:options, {:tearoff=>false, :selectcolor=>'blue'}],
|
||||
[:options, {:tearoff=>false, :selectcolor=>'blue'}],
|
||||
|
||||
[:radiobutton, 'byName', {
|
||||
:variable=>viewmode, :value=>'NAME',
|
||||
:label=>'by Name', :helpstr=>'View files by name order',
|
||||
:command=>proc{puts 'NAME'}
|
||||
}
|
||||
],
|
||||
[:radiobutton, 'byName', {
|
||||
:variable=>viewmode, :value=>'NAME',
|
||||
:label=>'by Name', :helpstr=>'View files by name order',
|
||||
:command=>proc{puts 'NAME'}
|
||||
}
|
||||
],
|
||||
|
||||
[:radiobutton, 'byDate', {
|
||||
:variable=>viewmode, :value=>'DATE',
|
||||
:label=>'by Date', :helpstr=>'View files by date order',
|
||||
:command=>proc{puts 'DATE'}
|
||||
}
|
||||
],
|
||||
[:radiobutton, 'byDate', {
|
||||
:variable=>viewmode, :value=>'DATE',
|
||||
:label=>'by Date', :helpstr=>'View files by date order',
|
||||
:command=>proc{puts 'DATE'}
|
||||
}
|
||||
],
|
||||
|
||||
[:cascade, 'prefs', {
|
||||
:label=>'Preferences', :menu=>[
|
||||
[:command, 'colors', {
|
||||
:label=>'Colors...', :helpstr=>'Change text colors',
|
||||
:command=>proc{puts 'COLORS'}
|
||||
}
|
||||
],
|
||||
[:cascade, 'prefs', {
|
||||
:label=>'Preferences', :menu=>[
|
||||
[:command, 'colors', {
|
||||
:label=>'Colors...', :helpstr=>'Change text colors',
|
||||
:command=>proc{puts 'COLORS'}
|
||||
}
|
||||
],
|
||||
|
||||
[:command, 'fonts', {
|
||||
:label=>'Fonts...', :helpstr=>'Change text font',
|
||||
:command=>proc{puts 'COLORS'}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
[:command, 'fonts', {
|
||||
:label=>'Fonts...', :helpstr=>'Change text font',
|
||||
:command=>proc{puts 'COLORS'}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
|
||||
#mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar,
|
||||
# :menubuttons=>menu_spec)
|
||||
# :menubuttons=>menu_spec)
|
||||
mb = Tk::Iwidgets::Menubar.new(:helpvariable=>helpvar)
|
||||
mb.configure(:menubuttons=>menu_spec)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ mb = Tk::Iwidgets::Menubar.new
|
|||
mb.menubuttons = [
|
||||
[:menubutton, 'file', {
|
||||
:text=>'File', :menu=>[
|
||||
[:command, 'new', {:label=>'New'}],
|
||||
[:command, 'close', {:label=>'Close'}],
|
||||
[:separator, 'sep1'],
|
||||
[:command, 'quit', {:label=>'Quit'}]
|
||||
[:command, 'new', {:label=>'New'}],
|
||||
[:command, 'close', {:label=>'Close'}],
|
||||
[:separator, 'sep1'],
|
||||
[:command, 'quit', {:label=>'Quit'}]
|
||||
]
|
||||
}
|
||||
],
|
||||
|
|
@ -26,17 +26,17 @@ mb.add(:command, '.edit.copy', :label=>'Copy', :underline=>1)
|
|||
mb.add(:command, '.edit.paste', :label=>'Paste', :underline=>0)
|
||||
|
||||
mb.add(:menubutton, '.options', :text=>'Options', :menu=>[
|
||||
[:radiobutton, 'byName', {
|
||||
:variable=>viewmode, :value=>'NAME', :label=>'by Name'}
|
||||
],
|
||||
[:radiobutton, 'byDate', {
|
||||
:variable=>viewmode, :value=>'DATE', :label=>'by Date'}
|
||||
]
|
||||
[:radiobutton, 'byName', {
|
||||
:variable=>viewmode, :value=>'NAME', :label=>'by Name'}
|
||||
],
|
||||
[:radiobutton, 'byDate', {
|
||||
:variable=>viewmode, :value=>'DATE', :label=>'by Date'}
|
||||
]
|
||||
])
|
||||
|
||||
mb.add(:cascade, '.options.prefs', :label=>'Preferences', :menu=>[
|
||||
[:command, 'colors', {:label=>'Colors...'}],
|
||||
[:command, 'fonts', {:label=>'Fonts...'}]
|
||||
[:command, 'colors', {:label=>'Colors...'}],
|
||||
[:command, 'fonts', {:label=>'Fonts...'}]
|
||||
])
|
||||
|
||||
mb.pack(:side=>:left, :anchor=>:nw, :fill=>:x, :expand=>true)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic,
|
||||
:labeltext=>'Messages', :labelpos=>:n,
|
||||
:height=>120, :width=>550,
|
||||
:savedir=>'/tmp', :textbackground=>'#d9d9d9')
|
||||
:labeltext=>'Messages', :labelpos=>:n,
|
||||
:height=>120, :width=>550,
|
||||
:savedir=>'/tmp', :textbackground=>'#d9d9d9')
|
||||
mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true)
|
||||
|
||||
mb.type_add('ERROR', :background=>'red', :foreground=>'white', :bell=>true)
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
mb = Tk::Iwidgets::Messagebox.new(:hscrollmode=>:dynamic,
|
||||
:labeltext=>'Messages', :labelpos=>:n,
|
||||
:height=>120, :width=>550,
|
||||
:savedir=>'/tmp', :textbackground=>'#d9d9d9')
|
||||
:labeltext=>'Messages', :labelpos=>:n,
|
||||
:height=>120, :width=>550,
|
||||
:savedir=>'/tmp', :textbackground=>'#d9d9d9')
|
||||
mb.pack(:padx=>5, :pady=>5, :fill=>:both, :expand=>true)
|
||||
|
||||
error = mb.type_add(:background=>'red', :foreground=>'white', :bell=>true)
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ mainloop = Thread.new{Tk.mainloop}
|
|||
# Standard question message dialog used for confirmation.
|
||||
#
|
||||
md = Tk::Iwidgets::Messagedialog.new(:title=>'Message Dialog',
|
||||
:text=>'Are you sure ? ',
|
||||
:bitmap=>'questhead', :modality=>:global)
|
||||
:text=>'Are you sure ? ',
|
||||
:bitmap=>'questhead', :modality=>:global)
|
||||
|
||||
md.buttonconfigure('OK', :text=>'Yes')
|
||||
md.buttonconfigure('Cancel', :text=>'No')
|
||||
|
|
@ -33,8 +33,8 @@ md.destroy
|
|||
bmp = '@' + File.join(File.dirname(File.expand_path(__FILE__)), '../catalog_demo/images/text.xbm')
|
||||
|
||||
cr = Tk::Iwidgets::Messagedialog.new(:title=>'Copyright',
|
||||
:bitmap=>bmp, :imagepos=>:n,
|
||||
:text=>"Copyright 200x XXX Corporation\nAll rights reserved")
|
||||
:bitmap=>bmp, :imagepos=>:n,
|
||||
:text=>"Copyright 200x XXX Corporation\nAll rights reserved")
|
||||
|
||||
cr.hide('Cancel')
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'tkextlib/iwidgets'
|
|||
# Create the tabnotebook widget and pack it.
|
||||
nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
|
||||
nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
|
||||
:side=>:left, :padx=>10, :pady=>10)
|
||||
:side=>:left, :padx=>10, :pady=>10)
|
||||
|
||||
# Add two pages to the tabnotebook,
|
||||
# labelled "Page One" and "Page Two"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'tkextlib/iwidgets'
|
|||
# Create the tabnotebook widget and pack it.
|
||||
nb = Tk::Iwidgets::Notebook.new(:width=>100, :height=>100)
|
||||
nb.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
|
||||
:side=>:top, :padx=>10, :pady=>0)
|
||||
:side=>:top, :padx=>10, :pady=>0)
|
||||
|
||||
# Add two pages to the tabnotebook,
|
||||
# labelled "Page One" and "Page Two"
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
om = Tk::Iwidgets::Optionmenu.new(:labelmargin=>5, :labelpos=>:w,
|
||||
:labeltext=>"Operating System :")
|
||||
:labeltext=>"Operating System :")
|
||||
|
||||
om.insert('end', 'Unix', 'VMS', 'Linux', 'OS/2', 'Windows NT', 'DOS')
|
||||
om.sort_ascending
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pw.pack(:fill=>:both, :expand=>true)
|
|||
|
||||
pw.child_site_list.each{|pane|
|
||||
TkButton.new(pane, :text=>pane.path, :relief=>:raised,
|
||||
:borderwidth=>2).pack(:fill=>:both, :expand=>true)
|
||||
:borderwidth=>2).pack(:fill=>:both, :expand=>true)
|
||||
}
|
||||
|
||||
pw.fraction(50,30,20)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pw.pack(:fill=>:both, :expand=>true)
|
|||
|
||||
pw.child_site_list.each{|pane|
|
||||
TkButton.new(pane, :text=>pane.path, :relief=>:raised,
|
||||
:borderwidth=>2).pack(:fill=>:both, :expand=>true)
|
||||
:borderwidth=>2).pack(:fill=>:both, :expand=>true)
|
||||
}
|
||||
|
||||
pw.fraction(50,30,20)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ mainloop = Thread.new{Tk.mainloop}
|
|||
TkOption.add('*textBackground', 'white')
|
||||
|
||||
pd = Tk::Iwidgets::Promptdialog.new(:modality=>:global, :title=>'Password',
|
||||
:labeltext=>'Password:', :show=>'*')
|
||||
:labeltext=>'Password:', :show=>'*')
|
||||
pd.hide('Apply')
|
||||
|
||||
if TkComm.bool(pd.activate)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
Tk::Iwidgets::Pushbutton.new(:text=>'Hello',
|
||||
:command=>proc{puts 'Hello World'},
|
||||
:defaultring=>true).pack(:padx=>10, :pady=>10)
|
||||
:command=>proc{puts 'Hello World'},
|
||||
:defaultring=>true).pack(:padx=>10, :pady=>10)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
sf = Tk::Iwidgets::Scrolledframe.new(:width=>150, :height=>180,
|
||||
:labeltext=>'scrolledframe')
|
||||
:labeltext=>'scrolledframe')
|
||||
cs = sf.child_site
|
||||
|
||||
TkButton.new(cs, :text=>'Hello').pack(:pady=>10)
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ require 'tkextlib/iwidgets'
|
|||
TkOption.add('*textBackground', 'white')
|
||||
|
||||
sh = Tk::Iwidgets::Scrolledhtml.new(:fontname=>'helvetica',
|
||||
:linkcommand=>proc{|href|
|
||||
sh.import_link(href)
|
||||
})
|
||||
:linkcommand=>proc{|href|
|
||||
sh.import_link(href)
|
||||
})
|
||||
sh.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
|
||||
|
||||
sh.import(Tk.getOpenFile(:title=>'select HTML document'))
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@ require 'tkextlib/iwidgets'
|
|||
TkOption.add('*textBackground', 'white')
|
||||
|
||||
slb = Tk::Iwidgets::Scrolledlistbox.new(:selectmode=>:single,
|
||||
:vscrollmode=>:static,
|
||||
:hscrollmode=>:dynamic,
|
||||
:labeltext=>'List',
|
||||
:selectioncommand=>proc{
|
||||
puts(slb.get_curselection)
|
||||
},
|
||||
:dblclickcommand=>proc{
|
||||
puts('Double Click')
|
||||
puts(slb.get_curselection)
|
||||
})
|
||||
:vscrollmode=>:static,
|
||||
:hscrollmode=>:dynamic,
|
||||
:labeltext=>'List',
|
||||
:selectioncommand=>proc{
|
||||
puts(slb.get_curselection)
|
||||
},
|
||||
:dblclickcommand=>proc{
|
||||
puts('Double Click')
|
||||
puts(slb.get_curselection)
|
||||
})
|
||||
slb.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
|
||||
|
||||
slb.insert('end', *['Hello', 'Out There', 'World'])
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
st = Tk::Iwidgets::Scrolledtext.new(:hscrollmode=>:dynamic, :wrap=>:none,
|
||||
:labeltext=>'Password File')
|
||||
:labeltext=>'Password File')
|
||||
st.pack(:expand=>true, :fill=>:both, :padx=>10, :pady=>10)
|
||||
|
||||
st.import('/etc/passwd')
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@ require 'tkextlib/iwidgets'
|
|||
TkOption.add('*textBackground', 'white')
|
||||
|
||||
sb = Tk::Iwidgets::Selectionbox.new.pack(:padx=>10, :pady=>10,
|
||||
:fill=>:both, :expand=>true)
|
||||
:fill=>:both, :expand=>true)
|
||||
|
||||
sb.insert_items('end', *['Hello', 'Out There', 'World'])
|
||||
|
||||
TkLabel.new(sb.child_site,
|
||||
:text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10)
|
||||
:text=>'Child Site is Here').pack(:fill=>:x, :padx=>10, :pady=>10)
|
||||
|
||||
sb.insert_items(2, 'Cruel Cruel')
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'tkextlib/iwidgets'
|
|||
mainloop = Thread.new{Tk.mainloop}
|
||||
|
||||
TkButton.new(:text=>'QUIT',
|
||||
:command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10)
|
||||
:command=>proc{Tk.root.destroy}).pack(:padx=>10, :pady=>10)
|
||||
|
||||
Tk::Iwidgets::Selectiondialog.new.activate
|
||||
|
||||
|
|
|
|||
|
|
@ -3,15 +3,15 @@ require 'tk'
|
|||
require 'tkextlib/iwidgets'
|
||||
|
||||
sh = Tk::Iwidgets::Shell.new(:modality=>:application,
|
||||
:padx=>20, :pady=>20, :title=>'Shell')
|
||||
:padx=>20, :pady=>20, :title=>'Shell')
|
||||
|
||||
TkButton.new(:text=>'ACTIVATE', :padx=>7, :pady=>7,
|
||||
:command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10)
|
||||
:command=>proc{puts sh.activate}).pack(:padx=>10, :pady=>10)
|
||||
|
||||
TkLabel.new(sh.child_site, :text=>'SHELL').pack
|
||||
TkButton.new(sh.child_site, :text=>'YES',
|
||||
:command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x)
|
||||
:command=>proc{sh.deactivate 'press YES'}).pack(:fill=>:x)
|
||||
TkButton.new(sh.child_site, :text=>'NO',
|
||||
:command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x)
|
||||
:command=>proc{sh.deactivate 'press NO'}).pack(:fill=>:x)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ require 'tkextlib/iwidgets'
|
|||
TkOption.add('*textBackground', 'white')
|
||||
|
||||
Tk::Iwidgets::Spinint.new(:labeltext=>'Temperature', :labelpos=>:w, :width=>5,
|
||||
:fixed=>true, :range=>[32, 212]).pack(:pady=>10)
|
||||
:fixed=>true, :range=>[32, 212]).pack(:pady=>10)
|
||||
|
||||
Tk.mainloop
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@ class Spinner_demo < TkWindow
|
|||
|
||||
def initialize(parent=nil)
|
||||
@spinner = Tk::Iwidgets::Spinner.new(parent, :labeltext=>'Month : ',
|
||||
:width=>10, :fixed=>10,
|
||||
:validate=>proc{|c| block_input},
|
||||
:decrement=>proc{spin_month -1},
|
||||
:increment=>proc{spin_month 1})
|
||||
:width=>10, :fixed=>10,
|
||||
:validate=>proc{|c| block_input},
|
||||
:decrement=>proc{spin_month -1},
|
||||
:increment=>proc{spin_month 1})
|
||||
@path = @spinner
|
||||
@spinner.insert(0, Months[0])
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'tkextlib/iwidgets'
|
|||
# Create the tabnotebook widget and pack it.
|
||||
tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
|
||||
tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
|
||||
:side=>:left, :padx=>10, :pady=>10)
|
||||
:side=>:left, :padx=>10, :pady=>10)
|
||||
|
||||
# Add two pages to the tabnotebook,
|
||||
# labelled "Page One" and "Page Two"
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ require 'tkextlib/iwidgets'
|
|||
# Create the tabnotebook widget and pack it.
|
||||
tn = Tk::Iwidgets::Tabnotebook.new(:width=>300, :height=>100)
|
||||
tn.pack(:anchor=>:nw, :fill=>:both, :expand=>true,
|
||||
:side=>:top, :padx=>10, :pady=>0)
|
||||
:side=>:top, :padx=>10, :pady=>0)
|
||||
|
||||
# Add two pages to the tabnotebook,
|
||||
# labelled "Page One" and "Page Two"
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ EOD
|
|||
##########################################
|
||||
|
||||
bmp_dir = File.join(File.dirname(File.expand_path(__FILE__)),
|
||||
'../catalog_demo/images')
|
||||
'../catalog_demo/images')
|
||||
|
||||
##########################################
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ Thread.new{
|
|||
}
|
||||
|
||||
Tk::Iwidgets::Watch.new(:state=>:disabled, :showampm=>:no,
|
||||
:width=>155, :height=>155){|w|
|
||||
:width=>155, :height=>155){|w|
|
||||
w.pack(:padx=>10, :pady=>10, :fill=>:both, :expand=>true)
|
||||
# TkTimer.new(1000, -1, proc{w.show; Tk.update}).start
|
||||
TkTimer.new(25, -1, proc{w.show; Tk.update}).start
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue