Creating Pulldown Menus (continued)
|
Step 4: Program the Parts
Program statements follow to create this menu system. The program lines listed refer to the lines in the
Menu System example program.
NOTE
The widgets that are created for this example are (in order):
·
|
Topmost PULLDOWN MENU widgets
|
Create the Parent PANEL Widget
420 !
430 ! Note that the main panel is set up so it automatically scales to the
440 ! entire display, except for the DISP, INPUT, and softkeys lines.
450 !
460 DIM S$[80],M$(0:2)[80]
470 INTEGER Cursor,State,N,D(1:4)
480 INTEGER Dw,Dh,X,Y
490 INTEGER Panelwidth, Panelheight, Prx, Pry, Prwidth, Prheight, Iw, Ih
500 !
510 GESCAPE CRT,3;D(*) ! Get display resolution.
520 Dw=D(3)-D(1)+1
530 Dh=D(4)-D(2)+1
540 Panelwidth=Dw*.75 ! Size PANEL.
550 Panelheight=Dh*.75
560 X=(Dw-Panelwidth)/2
570 Y=(Dh-Panelheight)/2
580 !
590 STATUS CRT,10;Cursor ! Turn off cursor, etc.
600 CONTROL CRT,10;0
610 RUNLIGHT OFF
620 KEY LABELS OFF
630 !
640 ! ****************************************************
650 !
660 ! Create the PANEL widget.
670 !
680 CLEAR SCREEN
690 ASSIGN @P TO WIDGET "PANEL";SET ("VISIBLE":0)
700 CONTROL @P;SET ("RESIZABLE":1)
710 CONTROL @P;SET ("X":X,"Y":Y,"WIDTH":Panelwidth,"HEIGHT":Panelheight)
720 CONTROL @P;SET ("TITLE":"MENU Widget Demo")
730 CONTROL @P;SET ("MAXIMIZABLE":0,"RESIZABLE":0)
740 !