This program allows menus to be easily included in your own programs. Examples of how to create and use menus within programs are given. Two lines could not be printed and must be added to the program: 50370 LOCATE 1,v:CALL &BD19: PRINT"[CONTROL—X]"+m$(v)+ SPACE$((wi)—LEN(m$(v)))+" [CONTROL-X]"; 50750 IF mh$<>"" THEN WINDOW #w(ml-1,mr,mt-2,mb: LOCATE £w,1,1 :PRINT #w"[CONTROL-X] [SPACE]"+mh$+"[SPACE] [CONTROL-X]";In these lines, type the bits between square brackets as single characters.To create windows, certain variables have to be set and then a particular subroutine called. An example is line 130. The variables are: ml — left position of window mt — top of window am — height of window wi — width of window w — the window number (0-7) mh$ — the title of the window GOSUB 50420 is used to create a window with a normal frame, GOSUB 50620 for one with a pulldown menu frame. If a window is accidentally positioned off-screen, it will be moved back on at the nearest point. To create a menu, the options have to be in data statements as in line 180. The data is held as follows: DATA menuno,type,title,xpos,ypo-s,option,option,.. - menuno — used in conjunction with off(menuno,optionno)
- type — 1 for ordinary, 2 for pulldown menu
- title — any string, can be blank xpos — left position for menu, 0 to, centre on x plane
- ypos — top position for menu, 0 to centre on y plane
- option — the option name; if left blank, a line of separators will appear in its place
- * — marks the end of the list of options
The maximum number of options in a menu is 23, or 22 if a title is used. Options within a menu can be switched off at any time using the off function:off(menuno,optionno)=1The result is to display the option in light type and prevent it from being selected until it's set to 0, which switches it on again.The program only works on the 464 and 664, but to convert it for the 6128, delete lines 70 and 51110 to 51200. Then replace the RSX calls in lines 50030 and 50260 with the equivalent on the 6128 using the bank manager RSXs supplied with the machine. To use the menus, use the cursor and copy keys. To incorporate them into your own programs, lines 50200-50260 do the selecting and v holds the value of the position of the selection bar at the end, so this can be used to determine the course of action to be taken. The variables holding the key codes for up, down and select are ku, kd and kf respectively. Australian Personal Computer |