0% found this document useful (0 votes)
392 views7 pages

Event Sequence in Visual FoxPro

The document discusses event sequences in Visual FoxPro. It describes how events are triggered by user interactions and in what order events occur for different objects like forms, controls, and the data environment. Sample code is provided to illustrate the event sequence for a form with controls like text boxes and command buttons.

Uploaded by

jvreferencia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
392 views7 pages

Event Sequence in Visual FoxPro

The document discusses event sequences in Visual FoxPro. It describes how events are triggered by user interactions and in what order events occur for different objects like forms, controls, and the data environment. Sample code is provided to illustrate the event sequence for a form with controls like text boxes and command buttons.

Uploaded by

jvreferencia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

31/12/2018 Event Sequence in Visual FoxPro

yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm

Though some events occur as single events, a user action often triggers multiple events. Some of
these events occur independently; however, some event sequences are fixed, for example, the event
sequence that occurs when a form is created or destroyed.

When a sequence of events is triggered for a control, the entire sequence of events is associated
with the control. For example, suppose you click the left mouse button on a command button and
the drag the mouse pointer away from the command button. The command button's MouseMove
event continues to occur even though the mouse pointer moves over the form. If you release the
left mouse button over the form instead of over the command button, the MouseUp event that
occurs is associated with the command button instead of the form.

The following table shows the general sequence of Visual FoxPro events, assuming that the data
environment's AutoOpenTables property is set to True (.T.). Other events can occur based on user
interaction and system response.

Object Event that occurs

Data environment BeforeOpenTables

Form set Load

Form Load

Data environment cursor(s) Init

Data environment Init

Objects 1 Init

Form Init

Form set Init

Form set Activate

Form Activate

Object1 2 When

Form GotFocus

http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 1/7
31/12/2018 Event Sequence in Visual FoxPro

Object1 GotFocus

Object1 Message

Object1 ValidВ 3

Object1 LostFocus

Object2 3 When

Object2 GotFocus

Object2 Message

Object2 ValidВ 4

Object2 LostFocus

Form QueryUnload

Form Destroy

Object 5 Destroy

Form Unload

Form set Unload

Data environment AfterCloseTables

Data environment Destroy

Data environment cursor(s) Destroy

1. For each object, from innermost object to outermost container 2. First object in the tab order 3.
Next object to get focus 4. As the object loses focus 5.For each object, from outermost container to
innermost object

Event Sequence Example


http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 2/7
31/12/2018 Event Sequence in Visual FoxPro

The following example uses a form to illustrate the order in which events occur in response to user
interaction.

In this example, the user performs the following


actions:

1. Runs the form.


2. Types text in the Text1 text box.
3. Selects the text and copies it to the Clipboard.
4. Moves to the Text2 text box by pressing the
TAB key.
5. Pastes the text into Text2.
6. Closes the form by clicking the Command2
command button.

These actions trigger system events for each object. The following tables list the events that occur in
response to each user action.

Note:

In this example, the Paint event has been removed from the tables because this event occurs frequently and
makes it difficult to see the sequences of the other events.

Action 1

The user runs the form by typing the following command in the Command window:

В  Copy Code

DO FORM form1 NAME


frmObject

Visual FoxPro loads the form, initializes each object, and then initializes the form. The form is
activated and the first text box receives input focus.

Object Event

DataEnvironment BeforeOpenTables

Form1 Load

DataEnvironment Init

Text1 Init

Text2 Init

http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 3/7
31/12/2018 Event Sequence in Visual FoxPro

Command1 Init

Command2 Init

Form1 Init

Form1 Activate

Form1 GotFocus

Text1 When

Text1 GotFocus

Action 2

The user types the text "Test" in the text box, Text1. Each keystroke generates two events.

Note:

The KeyPress event receives two parameters: a number representing the pressed key and the state of the
SHIFT, ALT, and CTRL keys.

Object Event Parameters

Text1 KeyPress (84 for "T", 1)

Text1 InteractiveChange В 

Text1 KeyPress (101 for "e", 0)

Text1 InteractiveChange В 

Text1 KeyPress (115 for "s", 0)

Text1 InteractiveChange В 

Text1 KeyPress (116 for "t",0)

Text1 InteractiveChange В 

Action 3
http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 4/7
31/12/2018 Event Sequence in Visual FoxPro

The user selects the text in the text box, Text1, by double-clicking the text and copies the text to the
Clipboard by pressing CTRL+C. Mouse events and a Click event accompany the DblClick event.

Note:

The MouseMove, MouseDown, and MouseUp events receive four parameters: a number indicating the
pressed button, the state of the SHIFT key, and (X, Y) coordinates. The X and Y coordinates are relative to the
form and reflect the form's scale mode, for example, pixels. Though only one MouseMove event is listed for
each control, in actuality, this event can occur half a dozen times or more.

Object Event Parameters

Form1 MouseMove (0, 0, 100, 35)

Text1 MouseMove (0, 0, 44, 22)

Text1 MouseDown (1, 0, 44, 22)

Text1 MouseUp (1, 0, 44, 22)

Text1 Click В 

Text1 MouseDown (1, 0, 44, 22)

Text1 MouseUp (1, 0, 44, 22)

Text1 DblClick В 

Action 4

The user moves to the text box, Text2, by pressing the TAB key.

Object Event Parameters

Text1 KeyPress (9, 0)

Text1 Valid В 

Text1 LostFocus В 

Text2 When В 

Text2 GotFocus В 

http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 5/7
31/12/2018 Event Sequence in Visual FoxPro

Action 5

The user pastes the text into the text box, Text2, by pressing CTRL+V.

Object Event

Text2 InteractiveChange

Action 6

The user clicks the command button, Command2, to close the form.

Object Event В 

Form1 MouseMove В 

Command2 MouseMove В 

Text2 Valid В 

Command2 When В 

Text2 LostFocus В 

Command2 GotFocus В 

Command2 MouseDown (1, 0, 143, 128)

Command2 MouseUp (1, 0, 143, 128)

Command2 Click В 

Command2 Valid В 

Command2 When В 

When the form closes and objects are released, additional events take place in the opposite order
of the events listed for Action 1.

Object Event

Form1 Destroy

http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 6/7
31/12/2018 Event Sequence in Visual FoxPro

Command2 Destroy

Command1 Destroy

Text2 Destroy

Text1 Destroy

Form1 Unload

DataEnvironment AfterCloseTables

DataEnvironment Destroy

See Also
Send comments about this topic to Microsoft. В© Microsoft Corporation. All rights reserved.

http://www.yaldex.com/fox_pro_tutorial/html/14fedca4-268d-4abb-af1f-091f5f5240c5.htm 7/7

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy