~ubuntu-branches/ubuntu/quantal/gclcvs/quantal

« back to all changes in this revision

Viewing changes to gcl-tk/demos/mkEntry2.tcl

  • Committer: Bazaar Package Importer
  • Author(s): Camm Maguire
  • Date: 2004-06-24 15:13:46 UTC
  • Revision ID: james.westby@ubuntu.com-20040624151346-xh0xaaktyyp7aorc
Tags: 2.7.0-26
C_GC_OFFSET is 2 on m68k-linux

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
    button $w.ok -text OK -command "destroy $w"
 
19
    pack $w.msg $w.frame $w.ok -side top -fill both
 
20
 
 
21
    entry $w.frame.e1 -relief sunken -scroll "$w.frame.s1 set"
 
22
    scrollbar $w.frame.s1 -relief sunken -orient horiz -command \
 
23
            "$w.frame.e1 view"
 
24
    frame $w.frame.f1 
 
25
    entry $w.frame.e2 -relief sunken -scroll "$w.frame.s2 set"
 
26
    scrollbar $w.frame.s2 -relief sunken -orient horiz -command \
 
27
            "$w.frame.e2 view"
 
28
    frame $w.frame.f2 
 
29
    entry $w.frame.e3 -relief sunken -scroll "$w.frame.s3 set"
 
30
    scrollbar $w.frame.s3 -relief sunken -orient horiz -command \
 
31
            "$w.frame.e3 view"
 
32
    pack $w.frame.e1 $w.frame.s1 $w.frame.f1 $w.frame.e2 $w.frame.s2 \
 
33
            $w.frame.f2 $w.frame.e3 $w.frame.s3 -side top -fill x
 
34
 
 
35
    $w.frame.e1 insert 0 "Initial value"
 
36
    $w.frame.e2 insert end "This entry contains a long value, much too long "
 
37
    $w.frame.e2 insert end "to fit in the window at one time, so long in fact "
 
38
    $w.frame.e2 insert end "that you'll have to scan or scroll to see the end."
 
39
}