1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM $XConsortium: ListBounds1.src /main/3 1996/04/23 20:18:16 drk $
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
10 XCOMM #########################################################################
14 XCOMM This sample shell script demonstrates how to create a list widget, and
15 XCOMM also how to query the bounds for each of the list items.
20 XCOMM Pushbutton Callback: Query the bound for each list item
25 while XmListPosToBounds $LIST $i X Y W H; do
26 echo "Bounds of item "$i" is ("$X $Y $W $H")"
31 XCOMM Pushbutton Callback: Delete the first list item
34 XmListDeletePos $LIST 1
37 XCOMM ###################### Create the Main UI ###############################
39 XtInitialize TOPLEVEL listKbd1 ListKbd1 "$0" "$@"
40 XtSetValues $TOPLEVEL allowShellResize:True
42 XmCreateScrolledList LIST $TOPLEVEL list \
44 items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
46 listSizePolicy:VARIABLE
49 selectedItems:"item2,item4,item6"
52 XtRealizeWidget $TOPLEVEL
54 XtCreateApplicationShell TOPLEVEL2 listKbd1a TopLevelShell
56 XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
57 orientation:HORIZONTAL \
61 XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
62 labelString:"Get Item Bounds"
63 XtAddCallback $PB1 activateCallback "GetBounds"
65 XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
66 labelString:"Delete First Item"
67 XtAddCallback $PB2 activateCallback "DelFirst"
69 XtRealizeWidget $TOPLEVEL2