Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
LISA G Who?
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00856120
Message ID:
00856277
Views:
14
This message has been marked as the solution to the initial question of the thread.
If you were to create a form (scx) and use DO FORM instead of CreateObject() to instantiate your object, then the LISA G holds true. Remember when you use CreateObject() VFP sets the objects visibility to .F.. I only remember READ EVENTS being necessary for an executable to run.

I tested this with VFP8SP1 and created a form based off of the Form base class. I put ? "{event name}" in each of the events. Three events (Load, Init, Show) print on the VFP desktop and two print on the form (Activate and Gotfocus).

Richard



>I have been generally aware of the order of Form events for some time but since I use Visual FoxExpress foundation (an older version) I haven't had to pay too much attention to the details.
>
>Now I'm digging into what happens and I need to be a little more precise.
>
>So here is the basic instantiation sequence (LISA G) as described in Wiki:
>
>LOAD - great place for form-wide settings, manually opening tables or views and setting relations, so they are ready before bound controls Init (Form INIT is too late for that). Also here could establish an ADO recordset, or get a data object ready??
>
>INIT - happens after LOAD and also after INIT of all controls and containers on the form, which Init from the inside-out. Put LPARAMETERS statement here to receive parameters passed to the form, but store them to form properties before INIT finishes, since they will go out of scope. Return .f. from INIT to shut down form instantiation.
>
>Can talk to form controls/containers during form INIT, but don't SetFocus to them here, since that will short-circuit instantiation and fire ACTIVATE and GOTFOCUS in order to do the control's SetFocus.
>
>SHOW - fires after INIT. _SCREEN.Activeform is still the previous form at this point, so you can grab a reference to the calling form for whatever purpose you might want -- right up to the end of SHOW.
>
>ACTIVATE - Fires after SHOW. This form now is _SCREEN.Activeform. ACTIVATE also fires whenever you bring focus back to this form from somewhere else in the same application.
>
>GOTFOCUS - fires after ACTIVATE.

>http://fox.wikis.com/WC.DLL?Wiki~FormEvents~VFP
>
>Now here is a test program and some trace output:
>
>Note that TESTFORM is based on the FORM base class and there is no event code other than the calls to TRACE_RS.
>
>So what I notice is that CREATEOBJECT automatically executes the LOAD event and then the INIT event but then it stops.
>
>I have to explicitly call SHOW() as the next step and then ACTIVATE happens automatically. But not GOTFOCUS. That doesn't happen until after I execute READ EVENTS.
>
>If READ EVENTS was already executing, I assume I would have to explicitly SetFocus() on one of the contained objects before GOTFOCUS would execute.
>
>So it looks sort of like this to me:
>
>LI (code) SA (code) G
>
>Have I got this right? Any one have any clarifying comments?
>
>Peter
State of Florida, DCF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform