GetEvent Command

Purpose

Monitors menu and window events

Syntax

GetEvent

Get_Event

Description

GetEvent is implemented for compatibility reasons with GFA-BASIC 16. GetEvent monitors the occurrence of events in menu bars, pop-up menus, and windows. GetEvent waits a maximum of 0.5 seconds. The message parameters are copied to the Menu() array. A message is handled by responding to corresponding values in the Menu() array.

GetEvent is not OLE compatible, and cannot be used with Ocxs.

Example

Global i%

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

Loop Until m$(i%) = "!!"//marks the end

m$(i%) = "      "//terminates a menu

OpenW # 1

Color 8

PBox 0, 0, 639, 349

Menu m$()       //activates the menu bar

Do

GetEvent

Exit If MouseK = 2

Trace MENU(1)

Switch MENU(1)

Case 0        // nothing happened for half a second

Case 1        // keypress

Case 2, 3     // mouse click

Case 4 To 19  // windows message

Case 20       // menu selection

Case 21       // redraw

EndSwitch

Loop

CloseW # 1

 

Sub Win_1_Close(Cancel?)

// Don't allow Win_1 to be closed using the close button

// only by right clicking

Cancel? = True

EndSub

Remarks

The GFA-BASIC 16 functionality is fully supported when using GetEvent and Menu(). Sleep does not copy the message parameters to the Menu() array.

See Also

Sleep, DoEvents, PeekEvent, Menu()

{Created by Sjouke Hamstra; Last updated: 07/10/2014 by James Gaite}