Monitors menu and window events
PeekEvent
Peek_Event
PeekEvent monitors the occurrence of events in menu bars, pop-up menus, and windows. PeekEvent stores the messages read from the message queue in the Menu() array. PeekEvent is not OLE compatible and will not execute event subs.
The relevant tests must be performed by the programmer. In contrast to GetEvent, PeekEvent does not wait.
Local i%
OpenW # 1
Dim m$(20)
Data Lissajous , Figure 1 , Figure 2 , Figure 3
Data Figure 4
Data End ,"", Names , Robert , Piere , Gustav
Data Emile , Hugo ,!!
i% = -1
Do
i%++
Read m$(i%)//read in the menu entries
Until m$(i%) = "!!"//marks the end
m$(i%) = ""//terminates a menu
Menu m$()//activates the menu bar
//
Do
PeekEvent
If MENU(1) = 1
Print "A key was pressed"
Else If MENU(1) = 20
Print "A menu entry was selected"
EndIf
Until MouseK = 2 Or Win_1 Is Nothing
CloseW # 1
PeekEvent is implemented for compatibility with GFA-BASIC 16, but should not be used in OLE programs.
See DoEvents for a discussion on PeekEvent and DoEvents.
{Created by Sjouke Hamstra; Last updated: 21/10/2014 by James Gaite}