mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 09:33:59 +02:00

* ext/tk/*: Support new features of Tcl/Tk8.6b1 and minor bug fixes. ( [KNOWN BUG] Ruby/Tk on Ruby 1.9 will not work on Cygwin. ) * ext/tk/*: Unify sources between Ruby 1.8 & 1.9. Improve default_widget_set handling. * ext/tk/*: Multi-TkInterpreter (multi-tk.rb) works on Ruby 1.8 & 1.9. ( [KNOWN BUG] On Ruby 1.8, join to a long term Thread on Tk callbacks may freeze. On Ruby 1.9, cannot create a second master interpreter (creating slaves are OK); supported master interpreter is the default master interpreter only. ) * ext/tk/lib/tkextlib/*: Update supported versions of Tk extensions. Tcllib 1.8/Tklib 0.4.1 ==> Tcllib 1.11.1/Tklib 0.5 BWidgets 1.7 ==> BWidgets 1.8 TkTable 2.9 ==> TkTable 2.10 TkTreeCtrl 2005-12-02 ==> TkTreeCtrl 2.2.9 Tile 0.8.0/8.5.1 ==> Tile 0.8.3/8.6b1 IncrTcl 2005-02-14 ==> IncrTcl 2008-12-15 TclX 2005-02-07 ==> TclX 2008-12-15 Trofs 0.4.3 ==> Trofs 0.4.4 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@24064 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
58 lines
1.9 KiB
Ruby
58 lines
1.9 KiB
Ruby
#
|
|
# entry (no scrollbars) widget demo (called by 'widget')
|
|
#
|
|
|
|
# toplevel widget
|
|
if defined?($entry1_demo) && $entry1_demo
|
|
$entry1_demo.destroy
|
|
$entry1_demo = nil
|
|
end
|
|
|
|
# demo toplevel widget
|
|
$entry1_demo = TkToplevel.new {|w|
|
|
title("Entry Demonstration (no scrollbars)")
|
|
iconname("entry1")
|
|
positionWindow(w)
|
|
}
|
|
|
|
base_frame = TkFrame.new($entry1_demo).pack(:fill=>:both, :expand=>true)
|
|
|
|
# label
|
|
msg = TkLabel.new(base_frame) {
|
|
font $font
|
|
wraplength '5i'
|
|
justify 'left'
|
|
text "Three different entries are displayed below. You can add characters by pointing, clicking and typing. The normal Motif editing characters are supported, along with many Emacs bindings. For example, Backspace and Control-h delete the character to the left of the insertion cursor and Delete and Control-d delete the chararacter to the right of the insertion cursor. For entries that are too large to fit in the window all at once, you can scan through the entries by dragging with mouse button2 pressed."
|
|
}
|
|
msg.pack('side'=>'top')
|
|
|
|
# frame
|
|
TkFrame.new(base_frame) {|frame|
|
|
TkButton.new(frame) {
|
|
text 'Dismiss'
|
|
command proc{
|
|
tmppath = $entry1_demo
|
|
$entry1_demo = nil
|
|
tmppath.destroy
|
|
}
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
|
|
TkButton.new(frame) {
|
|
text 'Show Code'
|
|
command proc{showCode 'entry1'}
|
|
}.pack('side'=>'left', 'expand'=>'yes')
|
|
}.pack('side'=>'bottom', 'fill'=>'x', 'pady'=>'2m')
|
|
|
|
#
|
|
e1 = TkEntry.new(base_frame, 'relief'=>'sunken')
|
|
e2 = TkEntry.new(base_frame, 'relief'=>'sunken')
|
|
e3 = TkEntry.new(base_frame, 'relief'=>'sunken')
|
|
[e1,e2,e3].each{|w| w.pack('side'=>'top', 'padx'=>10, 'pady'=>5, 'fill'=>'x')}
|
|
|
|
#
|
|
e1.insert(0, 'Initial value')
|
|
e2.insert('end', "This entry contains a long value, much too long ")
|
|
e2.insert('end', "to fit in the window at one time, so long in fact ")
|
|
e2.insert('end', "that you'll have to scan or scroll to see the end.")
|
|
e2.insert('end', "")
|
|
|