Event

Event

Welcome to our Knowledge Base

Documentation | Blog | Demos | Support

< All Topics
Print

Event

A data structure that provides information about the state of the system and the most recent event.

The Event data structure provides information about the most recent event and about the state of the system when that event occurred.

The components of the Event data structure are set when an event occurs in the user interface. An application program can use the information in the fields to determine what action, if any, to take.

The fields in the Event structure are

– AltKey

– CtrlKey

– EventName

– EventTag

– EventType

– FieldTag

– FormTag

– KeyPressed

– MenuItemTag

– MenuTag

– MouseClick

– ScrollingKey

– ShiftKey

– WindowTag

Syntax #1 – AltKey, CtrlKey, ShiftKey

Provides information about the state of the Alt, Ctrl, or Shift key during the last event

event.altkey

event.ctrlkey

event.shiftkey

Return Value

Character string (binary). Can be reset by the application program.

Description

The variables provide information about the state of the Alt, Ctrl, and Shift keys during the last event.

The string is set to ‘1’ ($True) if the indicated key was down when the last event occurred. Otherwise, it is set to ‘0’ ($False).

Syntax #2 – EventName

event.eventname

Where eventname is one of

  • Break, Canceled, Click, Closed, DoubleClick, GotFocus, HangUp, LostFocus, LostFocusModified, Modified, PanicExit, RightClick, Timeout, WindowFocusSwitch, or
  • the name of an accelerator key, such as F1, if the event type was accelerator

Return Value

Character string (alpha). Can be reset by the application program.

Description

The Event data structure provides information about the most recent event and about the state of the system when that event occurred.

The components of the Event data structure are set when an event occurs in the user interface. An application program can use the information in the fields to determine what action, if any, to take.

Syntax #3 – EventTag

event.eventtag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies, by its tag, the object in which the last user interface event occurred. The variable can be

EventType SettingEventTag Value Taken From
WindowEvent.WindowTag
MenuEvent.MenuTag
MenuitemEvent.MenuItemTag
FormEvent.FormTag
FormfieldEvent.FieldTag
AcceleratorEvent.FieldTag
SystemEvent.FieldTag

Syntax #4 – EventType

event.eventtype

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies the type of user interface event that last occurred.

– window

– menu

– menuitem

– form

– formfield

– accelerator

– system

Syntax #5 – FieldTag

event.fieldtag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies, by its tag, the current field at the time of the last event.

Syntax #6 – FormTag

event.formtag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable, identifies, by its tag, the current form at the time of the last event.

Syntax #7 – KeyPressed

event.keypressed

Return Value

Character string (CHAR). Can be reset by the application program.

Description

The variable indicates, by name, the pressed key that caused the last event to occur.

Note: The keynames associated with accelerator events, such as F1, are recorded in EventName.

Example

If the user presses the a key in a form field and a Modified event is intercepted by the application program, then Event.KeyPressed is set to a.

Syntax #8 – MenuItemTag

event.menuitemtag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies, by its tag, the selected item on the menu in the current window at the time of the last event.

Syntax #9 – MenuTag

event.menutag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies, by its tag, the current menu at the time of the last event.

Syntax #10 – MouseClick

event.mouseclick

Return Value

Character string (binary). Can be reset by the application program.

Description

The variable indicates if a mouse button acceleration caused an event to occur.

It is set to ‘1’ ($True) if the event was caused by pressing a mouse button that is defined as an accelerator for the window. Otherwise, it is set to ‘0’ ($False).

Syntax #11 – ScrollingKey

event.scrollingkey

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable indicates if an event corresponds to a defined SCROLL key.

It is set to ‘1’ ($True) if an event corresponds to an accelerator key that is also a defined SCROLL key for the window. Otherwise, it is set to ‘0’ ($False).

Accelerators and SCROLL keys are defined using WINDOW SET commands.

Example

The application fragment that follows enables employee records to be scrolled through a form and the data to be updated. The combined actions are accomplished by defining certain keys both as accelerators and SCROLL keys. When one of these keys is pressed, the corresponding accelerator event occurs. The application program uses ScrollingKey to detect that a SCROLL key was pressed and performs the scrolling action after saving the updated data.

window set scroll Up F7 Down F8

window set accelerator F7 F8 escape

form open fEmployee

form set scroll fEmployee from EmpSet

form display

while

form input

if event.scrollingkey = $true

if thisform.formchanged = $true

  change EmpSet from fEmployee

   endif

  form scroll

  continue

endif

… other commands …

endwhile

Syntax #12 – WindowTag

event.windowtag

Return Value

Character string (ALPHA). Can be reset by the application program.

Description

The variable identifies, by its tag, the current window at the time of the last event.

See Also

FORM INPUT

FORM SET

MENU INPUT

MENU SET

RightClick

ThisForm

ThisMenu

WINDOW SET

Was this article helpful?
0 out of 5 stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
5
How can we improve this article?
Please submit the reason for your vote so that we can improve the article.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_CAEnglish