convert all Imakefile LinuxDistribution to LinuxArchitecture.
[oweals/cde.git] / cde / programs / dtksh / examples / PopupTest.src
1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM  $XConsortium: PopupTest.src /main/3 1996/04/23 20:18:36 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 demonstrates the steps necessary to create and
15 XCOMM  manage a popup menu.
16 XCOMM 
17
18
19 XCOMM  This event handler positions the menu at the point where the button event
20 XCOMM  occurred, and then posts the popup menu.
21 EventHandler()
22 {
23    XmMenuPosition $POPUP $EH_EVENT
24    XtManageChild $POPUP
25 }
26
27
28 XCOMM  Menu button callback
29 MenuActivated()
30 {
31    echo "Menu Activated: "$1
32 }
33
34
35
36
37 XCOMM ###################### Create the Main UI ###############################
38
39 XtInitialize TOPLEVEL popupTest PopupTest "$0" "$@"
40
41 XtCreateManagedWidget FORM form XmForm $TOPLEVEL
42 XtSetValues $FORM height:300  width:300
43 XtAddEventHandler $FORM "ButtonPressMask" False EventHandler
44
45 XmCreatePopupMenu POPUP $FORM "popup"
46 XmCreatePushButton PB1 $POPUP "pb1" \
47         labelString:"Menu Item 1"
48 XtManageChild $PB1
49 XtAddCallback $PB1 activateCallback "MenuActivated MenuItem1"
50 XmCreatePushButton PB2 $POPUP "pb2" \
51         labelString:"Menu Item 2"
52 XtManageChild $PB2
53 XtAddCallback $PB2 activateCallback "MenuActivated MenuItem2"
54
55 XtRealizeWidget $TOPLEVEL
56
57 XtMainLoop