convert all Imakefile LinuxDistribution to LinuxArchitecture.
[oweals/cde.git] / cde / programs / dtksh / examples / TextDisp1.src
1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM  $XConsortium: TextDisp1.src /main/3 1996/04/23 20:18:56 drk $
3
4 XCOMM #########################################################################
5 XCOMM   (c) Copyright 1993, 1994 Hewlett-Packard Company        
6 XCOMM   (c) Copyright 1993, 1994 International Business Machines Corp.
7 XCOMM   (c) Copyright 1993, 1994 Sun Microsystems, Inc.
8 XCOMM   (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
9 XCOMM       Novell, Inc.
10 XCOMM #########################################################################
11
12
13 XCOMM 
14 XCOMM  This sample shell script exercises the commands which enable and disable
15 XCOMM  updating in a text widget.  If the update is disabled, and the value of
16 XCOMM  the text field is then changed, the text field will not update what is
17 XCOMM  shown, until update is again enabled.
18 XCOMM 
19
20 XCOMM  Pushbutton Callback: enable update in the text widget
21 EnableUpdate()
22 {
23    XmTextEnableRedisplay $TEXT
24 }
25
26 XCOMM  Pushbutton Callback: disable update in the text widget
27 DisableUpdate()
28 {
29    XmTextDisableRedisplay $TEXT
30 }
31
32 XCOMM  Pushbutton Callback: changes the text value
33 ChangeValue1()
34 {
35    XmTextSetString $TEXT "line A
36 line B
37 line C
38 line D
39 line E
40 line F
41 line G"
42 }
43
44 XCOMM  Pushbutton Callback: changes the text value
45 ChangeValue2()
46 {
47    XmTextSetString $TEXT "line a
48 line b
49 line c
50 line d
51 line e
52 line f
53 line g"
54 }
55
56
57 XCOMM ###################### Create the Main UI ###############################
58
59 XtInitialize TOPLEVEL textDisp1 TextDisp1 "$0" "$@"
60 XtSetValues $TOPLEVEL allowShellResize:True
61
62 XmCreateScrolledText TEXT $TOPLEVEL text \
63         columns:20 \
64         rows:5 \
65         editMode:MULTI_LINE_EDIT \
66         value:\
67 "line 1
68 line 2
69 line 3
70 line 4"
71 XtManageChild $TEXT
72
73 XtRealizeWidget $TOPLEVEL
74
75 XtCreateApplicationShell TOPLEVEL2 textDisp1a TopLevelShell
76
77 XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
78          orientation:HORIZONTAL \
79          numColumns:2 \
80          packing:PACK_COLUMN 
81
82 XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
83         labelString:"Disable Update"
84 XtAddCallback $PB1 activateCallback "DisableUpdate"
85
86 XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
87         labelString:"Enable Update"
88 XtAddCallback $PB2 activateCallback "EnableUpdate"
89
90 XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
91         labelString:"Change Value 1"
92 XtAddCallback $PB3 activateCallback "ChangeValue1"
93
94 XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
95         labelString:"Change Value 2"
96 XtAddCallback $PB4 activateCallback "ChangeValue2"
97
98 XtRealizeWidget $TOPLEVEL2
99
100 XtMainLoop