Category : Dbase (Clipper, FoxBase, etc) Languages Source Code
Archive   : PDMENUS.ZIP
Filename : MAKEMENU.PRG

 
Output of file : MAKEMENU.PRG contained in archive : PDMENUS.ZIP

* Program ...: MAKEMENU.PRG
* By ........: John Cunningham
* : Personalized Database Systems
* : (415) 644-0476
* Date ......: 05/25/87

* Use the following program to generate pulldown menus.

* This program is provided to generate menus like those found in the jukebox
* program in the QS 1.1 demo. First, change the menu specs found at the top
* of this program under QS or XL. It will generate the menus specified as
* above.

* In your program, RESTORE from the memfile ADDITIVE to get the menu specs,
* and WSET WINFILE to the window file you should build. To do this, set up
* a text file containing the names of each of the menus (ie:
* MENU0.scn
* MENU1.scn
* MENU2.scn
* in this example) and execute BUILDWIN . This will greatly increase
* performance for displaying each of the saved menus.

* MENUS.PRG, included in this .ARC, needs to be used to give the pull-down
* effect. Initially, the menus must be set up with the PAINT procedure, and
* then executed with the MENU procedure. The global variable MCHOICE is used
* to return the selected menu choice.

* Below is a example program using pulldown menus under this context:

* SET PROCEDURE TO menus
* WSET WINFILE TO
* RESTORE FROM ADDITIVE
* DO paint
* DO WHILE .T.
* DO menu
* DO CASE
* CASE mchoice=00
* ...
* CASE mchoice=01
* ...
* CASE mchoice=10
* ...
* CASE mchoice=11
* ENDCASE
* ENDDO

set safety off
set talk off

*******************************************************************************
* THE FOLLOWING CODE MUST BE MODIFIED TO CREATE THE PULLDOWN MENUS AS NEEDED *
* FOR YOUR APPLICATION. ALL OF THE VARIABLES DEFINED BELOW ARE SAVED TO A *
* VARIABLE FILE FOR LATER RECALL. *
*******************************************************************************

STORE 3 TO menus && quantity of pull down menus

STORE 2 TO mhoriz0 && horizontal coord of menu 0 (left)
STORE 10 TO mhoriz1 && hor. coord of menu 1 (middle menu)
STORE 17 TO mhoriz2 && " " " " " 2

STORE 2 TO moptions0 && quantity of options for menu 0
STORE 4 TO moptions1 && " " " " " " " 1
STORE 2 TO moptions2 && " " " " " " " 2

STORE 'Player' TO menu0 && title of menu 0
STORE 'Play Current Song ' TO menu00 && first option of menu 0
STORE 'Quit to Main Menu ' TO menu01 && second option
STORE 'PQ' to mcodes0 && hot keys for this menu
&& ie: hitting P selects "Play"
STORE 'Songs' TO menu1
STORE 'A Major scale ' TO menu10
STORE 'Twinkle twinkle little star ' TO menu11
STORE 'Row row row your boat ' TO menu12
STORE 'Mary had a little lamb ' TO menu13
store 'ATRM' to mcodes1

STORE 'Options' TO menu2
STORE 'Tempo ' TO menu20
STORE 'Automatic Repeat' TO menu21
store 'TM' to mcodes2

store 0 to menu, option, mchoice && just working menu variables
&& used in MENU.PRG

save to jukebox.mem && create file for menu variables
&& this the described above

****************************************************************************
* THE FOLLOWING CODE ACTUALLY GENERATES THE MENUS AS SPECIFIED ABOVE. YOU *
* DO NOT NEED TO MODIFY ANY OF THE CODE BELOW, UNLESS YOU WISH TO MODIFY *
* THE MENU COLOR. *
****************************************************************************

STORE 0 TO menu
DO WHILE menu STORE STR(menu,1) TO smenu
WSET WINDOW menu TO 2, 1+mhoriz&smenu, 1+moptions&smenu, mhoriz&smenu;
+ LEN(menu&smenu.0) COLOR w+/b, b/w, w+/b
WSELECT 1
WUSE menu
@ 0,0 GET menu&smenu.0
CLEAR GETS
STORE 1 TO option
DO WHILE option STORE STR(option,1) TO soption
@ option, 0 SAY menu&smenu.&soption
STORE option+1 TO option
ENDDO
WSAVE TO menu&smenu
WCLOSE
STORE menu+1 TO menu
ENDDO