1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM $XConsortium: ListPosSel1.src /main/3 1996/04/23 20:18:25 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 verifies that the XmListPosSelected command works; this command
16 XCOMM returns information about whether an indicated list item is selected.
21 XCOMM Pushbutton Callback: print the selection state of each list item.
26 while (($i <= 11 )); do
27 if XmListPosSelected $LIST $i; then
28 echo "Item "$i" is selected"
30 echo "Item "$i" is not selected"
36 XCOMM ###################### Create the Main UI ###############################
38 XtInitialize TOPLEVEL listPosSel1 ListPosSel1 "$0" "$@"
39 XtSetValues $TOPLEVEL allowShellResize:True
41 XmCreateScrolledList LIST $TOPLEVEL list \
43 items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
45 listSizePolicy:VARIABLE
48 selectedItems:"item2,item4,item6"
51 XtRealizeWidget $TOPLEVEL
53 XtCreateApplicationShell TOPLEVEL2 ListPosSel1a TopLevelShell
55 XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
56 orientation:HORIZONTAL \
60 XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
61 labelString:"Get Item Selection Status"
62 XtAddCallback $PB1 activateCallback "GetSelectionStatus"
64 XtRealizeWidget $TOPLEVEL2