Home Gadgetman Forum Book Reviews Links Contact me X-UFO
Gadgets Processors Programming School Old news
The Menu can be activated in two ways:
  1. The [Menu] key
  2. The stylus pointing at the upper left corner.
Both cases can be handled by the same PROC Here's how to handle it:
GLOBAL lastused%   REM Defined in the first PROC, NOT in this...
------
LOCAL selected%   REM Defined in THIS PROC
------
   mINIT
   mCARD "File","Create",%n,"Open",%o,"Exit",%e
   mCARD "Edit","Cut",%x,"Copy",%c,"Paste",%v
   mCARD "Tools","About",%A,"Help",-%H,"Register",1
------
   selected%=MENU(lastused%)

this part of the code creates three menus and displays them, placing the result in the selected% variable. Some points to remember in this code: As for what to do with the value in the Selected% variable:
If you used any numerics between 1 and 32 those must be handled separately. Then do the Lower case/Upper case values:

Messy? You could do this:

   IF selected%            REM just in case the user Escape's...
      IF selected% < 28   REM Numeric
         @("numeric"+CHR$(selected%+45)): 
      ELSEIF selected% < 96    REM Upper case
         @("ucase"+CHR$(selected%)):
      ELSE                     REM Lower case
         @("lcase"+CHR$(selected%)):
      ENDIF
   ENDIF

The @() function calls a procedure with the same name as the input string. it CAN NOT call procedures that need Input parameters OR returns a value...


<<6. The Event loop>>
<<How to build an application>>
<<8. The [Ctrl] Key>>