convert all Imakefile LinuxDistribution to LinuxArchitecture.
[oweals/cde.git] / cde / programs / dtksh / examples / TextFXYPos1.src
1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM  $XConsortium: TextFXYPos1.src /main/3 1996/04/23 20:19:01 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 verifies that the XmTextFieldPosToXY command
15 XCOMM  functions correctly.
16 XCOMM 
17
18 XCOMM  Pushbutton Callback: exercise the Text functions
19 RunTests()
20 {
21 XCOMM   This position should not be visible
22    if XmTextFieldPosToXY $TEXT 90 X Y; then
23       echo "Text position 90 is at point ("$X","$Y")"
24    else
25       echo "Text position 90 is not currently visible"
26    fi
27
28 XCOMM   This position should be visible
29    if XmTextFieldPosToXY $TEXT 3 X Y; then
30       echo "Text position 3 is at point ("$X","$Y")"
31    else
32       echo "Text position 3 is not currently visible"
33    fi
34
35    XmTextFieldXYToPos POS $TEXT $X $Y
36    echo "At point ("$X","$Y") is character position "$POS
37 }
38
39
40 XCOMM ###################### Create the Main UI ###############################
41
42 XtInitialize TOPLEVEL textFXYPos1 TextFXYPos1 "$0" "$@"
43 XtSetValues $TOPLEVEL allowShellResize:True
44
45 XmCreateTextField TEXT $TOPLEVEL text \
46         columns:20 \
47         value:"line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8"
48 XtManageChild $TEXT
49
50 XtRealizeWidget $TOPLEVEL
51
52 XtCreateApplicationShell TOPLEVEL2 textFXYPos1a TopLevelShell
53
54 XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
55          orientation:HORIZONTAL \
56          numColumns:2 \
57          packing:PACK_COLUMN 
58
59 XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
60         labelString:"Run XY Position Tests"
61 XtAddCallback $PB1 activateCallback "RunTests"
62
63 XtRealizeWidget $TOPLEVEL2
64
65 XtMainLoop