home *** CD-ROM | disk | FTP | other *** search
- // This is a simple example simply to show the range of possibilities on
- // a single menu. Notice how the second option has its own color settings,
- // how option 3 starts out as "inactive" and how hotkeys and idle events
- // are defined.
-
- #include "omenu.ch"
-
- LOCAL aMenu
-
- DEFINE MENU
- PROMPT "~New File"
- PROMPT "~Open File" COLOR "GR+/BG,R/BG,W+/R,W/BG,W/R"
- PROMPT "~Save" INACTIVE
- PROMPT "Save ~As"
- PROMPT LINE
- PROMPT "E~xit" DO MenuAbort
-
- HOTKEY NIL DO WrongKey // Beep if key not defined
- IDLE 30 SECONDS DO MenuAbort // "Timeout" after 30 seconds
- IDLE 1 SECONDS DO ShowTime // Update clock in corner every second
- CREATE aMenu @ 12,40 ALIGN center BORDER single
-
- CLEAR
-
- ACTIVATE MENU aMenu
- DO WHILE MenuChoice( aMenu ) != 0
-
- DO CASE
- CASE MenuChoice( aMenu ) == 1
- // New File Stuff Here
-
- CASE MenuChoice( aMenu ) == 2
- // Open File Stuff Here
-
- CASE MenuChoice( aMenu ) == 3
- // Save Stuff Here
-
- CASE MenuChoice( aMenu ) == 4
- // SaveAs Stuff Here
-
- ENDCASE
-
- ACTIVATE MENU aMenu
- ENDDO
- RETURN
-
- FUNCTION WrongKey( aMenu, nKey )
-
- ?? CHR(7)
-
- RETURN aMenu
-
- FUNCTION ShowTime( aMenu )
-
- LOCAL cOldColor, nRow, nCol
-
- cOldColor := SETCOLOR("W+/N")
- nRow := ROW()
- nCol := COL()
-
- @ 1,71 SAY TIME()
-
- SETCOLOR(cOldColor)
- @ nRow,nCol say ""
-
- RETURN aMenu
-