Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ActiveX Interferes with Form Init Sequence?
Message
From
29/09/2001 08:03:27
 
 
To
28/09/2001 15:42:53
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00562075
Message ID:
00562226
Views:
30
Hi!

VFP Init of the form is fired AFTER all other controls initialized. Activate of the form goes after Init of the form. Certain ActiveX controls can call Windows API functions that cause VFP form window activated more earlier than needed - just when ActiveX control created. This looks like following:

Normal sequense:

Label1.Init
Container1.Init
Form.Init
Form.Activate

Your ActiveX sequesnce:
Label1.Init
ActiveX.Init (and creating)
Form.Activate -- here VFP form received event to activate a form Window
-- that is not yet initialized properly.
Container1.Init
Form.Init


When working with such ActiveX controls and ActiveX does not allow to change this nehavior by some property, just create the ActiveX class in the class library and add it to the form on the fly ta the end of Init method code on the form. This will assure that all controls are already initialized properly before Activate event fired by ActiveX. Of course, you can try make ActiveX initialize at the last moment (Bring to front/Send to back options in form designer also change the order of controls initializing), however, form Init could contain code that require to run BEFORE Activate event of the form.

HTH.

>Hi,
>
>Does anyone know if some ActiveX controls interfere with the normal Init sequence in a form? It seems pretty clear in my head what is happening, but let me try to put it in words.
>
>In my Init and Activate methods, I am creating and initializing some properties/objects. I am also resizing the controls, based on the size of the form. If I use no ActiveX controls, everything works just fine. But, with some ActiveX controls I place on the form, I start having problems. For instance, the form starts crashing in the Activate method when it encounters code referring to normal controls on the form. All of a sudden, the form says that the control is an "Unknown Member".
>
>It seems as though the ActiveX control is interfering with the normal sequence of events, skipping instantiation of some of the controls (for example, a textbox) before I try to refer to them. Or it might be preventing some of the controls on the form from instantiating.
>
>The two ActiveX controls causing problems are the Namo WebEditor control and the MS DHTML control. Another HTML editing control, from Ephox, doesn't cause this problem, nor do any of my other ActiveX controls.
>
>I have changed AutoYield to .F. in the Load event of the form. I'm even using SYS(2333, 0), though I'll be darned if I know what that actually does.
>
>I've tried stepping through the code, but I keep getting the dreaded C00000005 error everytime I do. But, that is another problem. So, for the time being, I'm left to try and decipher this problem without the debugger.
>
>I was recently told to look at the July 2000 FoxPro Advisor tip, "Avoid VFP Bug in _SCREEN.ActiveForm". I tried the code, and it didn't help. I still get the error "Unknown Member".
>
>I am using VFP 6.0 SP5 and Win2k.
>
>Does anyone have any help to offer?
>
>-Bri.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform