]> git.zerfleddert.de Git - micropolis/blob - src/tk/library/demos/mkEntry2.tcl
add simple Makefile in top directory
[micropolis] / src / tk / library / demos / mkEntry2.tcl
1 # mkEntry2 -
2 #
3 # Create a top-level window that displays a bunch of entries with
4 # scrollbars.
5 #
6 # Arguments:
7 # w - Name to use for new top-level window.
8
9 proc mkEntry2 {{w .e2}} {
10 catch {destroy $w}
11 toplevel $w
12 dpos $w
13 wm title $w "Entry Demonstration"
14 wm iconname $w "Entries"
15 message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 200 \
16 -text "Three different entries are displayed below, with a scrollbar for each entry. You can add characters by pointing, clicking and typing. You can delete by selecting and typing Control-d. Backspace, Control-h, and Delete may be typed to erase the character just before the insertion point, Control-W erases the word just before the insertion point, and Control-u clears the entry. For entries that are too large to fit in the window all at once, you can scan through the entries using the scrollbars, or by dragging with mouse button 2 pressed. Click the \"OK\" button when you've seen enough."
17 frame $w.frame -borderwidth 10
18 pack append $w.frame \
19 [entry $w.frame.e1 -relief sunken] {top fillx} \
20 [scrollbar $w.frame.s1 -relief sunken -orient horiz -command \
21 "$w.frame.e1 view"] {top fillx} \
22 [frame $w.frame.f1 -geometry 20x10] {top} \
23 [entry $w.frame.e2 -relief sunken] {top fillx} \
24 [scrollbar $w.frame.s2 -relief sunken -orient horiz -command \
25 "$w.frame.e2 view"] {top fillx} \
26 [frame $w.frame.f2 -geometry 20x10] {top} \
27 [entry $w.frame.e3 -relief sunken] {top fillx} \
28 [scrollbar $w.frame.s3 -relief sunken -orient horiz -command \
29 "$w.frame.e3 view"] {top fillx}
30 $w.frame.e1 config -scroll "$w.frame.s1 set"
31 $w.frame.e1 insert 0 "Initial value"
32 $w.frame.e2 config -scroll "$w.frame.s2 set"
33 $w.frame.e2 insert end "This entry contains a long value, much too long "
34 $w.frame.e2 insert end "to fit in the window at one time, so long in fact "
35 $w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
36 $w.frame.e3 config -scroll "$w.frame.s3 set"
37
38 button $w.ok -text OK -command "destroy $w"
39 pack append $w $w.msg {top fill} $w.frame {top expand fill} \
40 $w.ok {bottom fill}
41 }
Impressum, Datenschutz