home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / CLIPB52.ZIP / MENU.ZIP / SAMPLE1.PRG < prev   
Encoding:
Text File  |  1990-05-15  |  1.4 KB  |  67 lines

  1. // This is a simple example simply to show the range of possibilities on
  2. // a single menu.  Notice how the second option has its own color settings,
  3. // how option 3 starts out as "inactive" and how hotkeys and idle events
  4. // are defined.
  5.  
  6. #include "omenu.ch"
  7.  
  8. LOCAL aMenu
  9.  
  10. DEFINE MENU
  11.    PROMPT "~New File" 
  12.    PROMPT "~Open File" COLOR "GR+/BG,R/BG,W+/R,W/BG,W/R"
  13.    PROMPT "~Save" INACTIVE
  14.    PROMPT "Save ~As" 
  15.    PROMPT LINE
  16.    PROMPT "E~xit" DO MenuAbort
  17.  
  18.    HOTKEY NIL DO WrongKey           // Beep if key not defined
  19.    IDLE 30 SECONDS DO MenuAbort     // "Timeout" after 30 seconds
  20.    IDLE 1 SECONDS DO ShowTime       // Update clock in corner every second
  21. CREATE aMenu @ 12,40 ALIGN center BORDER single
  22.  
  23. CLEAR
  24.  
  25. ACTIVATE MENU aMenu
  26. DO WHILE MenuChoice( aMenu ) != 0
  27.  
  28.    DO CASE
  29.       CASE MenuChoice( aMenu ) == 1
  30.          // New File Stuff Here
  31.  
  32.       CASE MenuChoice( aMenu ) == 2
  33.          // Open File Stuff Here
  34.  
  35.       CASE MenuChoice( aMenu ) == 3
  36.          // Save Stuff Here
  37.  
  38.       CASE MenuChoice( aMenu ) == 4
  39.          // SaveAs Stuff Here
  40.  
  41.    ENDCASE
  42.  
  43.    ACTIVATE MENU aMenu
  44. ENDDO
  45. RETURN
  46.  
  47. FUNCTION WrongKey( aMenu, nKey )
  48.  
  49.   ?? CHR(7)
  50.  
  51. RETURN aMenu
  52.  
  53. FUNCTION ShowTime( aMenu )
  54.  
  55.   LOCAL cOldColor, nRow, nCol
  56.  
  57.   cOldColor := SETCOLOR("W+/N")
  58.   nRow := ROW()
  59.   nCol := COL()
  60.  
  61.   @ 1,71 SAY TIME()
  62.  
  63.   SETCOLOR(cOldColor)
  64.   @ nRow,nCol say ""
  65.  
  66. RETURN aMenu
  67.