Partager via


Visual FoxPro System Events (API Library Construction)

In this table, each Visual FoxPro event is listed along with the layout of its event record fields and a description of when the event occurs.

Event EventRec Fields Description
nullEvent what = nullEvent
where.h = horizontal mouse location
where.v = vertical mouse location
when = ticks since startup
Occurs when no other events
are pending. This is the most frequently occurring event and, for performance reasons, should be used sparingly.
mouseDownEvent what = mouseDownEvent
where.h = horizontal mouse location
where.v = vertical mouse location
mbState = left mouse button
when = ticks since startup
Occurs whenever the left mouse button is pressed. Trap for the mouseDownEvent and use this in combination with the where point and _FindWindow function to see if the user clicked on the close menu box or on other parts of a window. (A closeEvent is not generated when you click on the close menu box of a window.)
keyDownEvent what = keyDownEvent
where.h = horizontal mouse location
where.v = vertical mouse location
message = key code
(see Appendix A)
modifier = modifier key
when = ticks since startup
Occurs whenever a key is pressed on the keyboard or whenever the keyboard buffer is played.
deactivateEvent what = deactivateEvent
where.h = horizontal mouse location
where.v = vertical mouse location
message = WHANDLE to window
when = ticks since startup
Occurs whenever a window becomes deactivated by clicking on the close menu box, activating another window or using the DEACTIVATE WINDOW command. A deactivateEvent is usually followed by an activateEvent.
activateEvent what = activateEvent
where.h = horizontal mouse location
where.v = vertical mouse location
message = WHANDLE to window
when = ticks since startup
Occurs whenever a window is activated. This includes system and user windows as well as dialogs, so it is suggested that whenever you receive this type of event, you check to see if it pertains to your window. An activateEvent is usually preceded by a deactivateEvent.
menuHitEvent what = menuHitEvent
misc = MENUID
misc2 = BAR #
when = ticks since startup
modifier = modifier key
Occurs when a user makes a selection from a menu-type item. Menu-type items include menus, popups and scrollable lists. Because menuHitEvents occur very often, it is best to use the _OnSelection function to do a certain task upon a menu selection so you can eliminate a lot of extra event checking.
closeEvent what = closeEvent
message = WHANDLE to window
when = ticks since startup
Occurs when a window is removed from memory with the RELEASE WINDOW command or by exiting Visual FoxPro. To check if a user closed a window by clicking on the close menu box, check for a mouseDownEvent.
hideEvent what = hideEvent
when = ticks since startup
Occurs when a window is hidden with the HIDE WINDOW command.
showEvent what = showEvent
when = ticks since startup
Occurs when a window is shown with the SHOW WINDOW command.
hotkeyEvent what = hotkeyEvent
where.h = horizontal mouse location
where.v = vertical mouse location
message = key code
(see FoxPro Key Codes chapter)
modifier = modifier key
when = ticks since startup
Occurs when the user presses a key that has actions assigned to it with the ON KEY LABEL command.
sizeEvent what = sizeEvent
when = ticks since startup
Occurs only when a ZOOM WINDOW or SIZE WINDOW command is issued. To check for an instance of a user clicking on the size control of a window, check for a mouseDownEvent.
zoomEvent what = zoomEvent
when = ticks since startup
Occurs only when the ZOOM WINDOW command is executed. To check for the instance of a user clicking on the zoom control, check for a mouseDownEvent.

See Also

External API Library Routines A-Z | External API Library Routines by Category | Visual FoxPro Key Codes (API Library Construction) | Activate Event