Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The proper use of the AutoYield property
Message
 
To
28/11/1997 19:12:57
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00062393
Message ID:
00062848
Views:
59
Vlad, Jim, Hank,

Trying to sum up the several opinions expressed here.

1. The AutoYield property is not properly documented.
2. VFP programmers should be aware of its existence and check if it applies to the particular OCX they are implementing.
3. Since we have the possibility to subclass OCX controls, it should be a good practice for OCX's that receive focus to put _VFP.AutoYield = .F. in their GETFOCUS() and _VFP.AutoYield = .T. in their LOSTFOCUS().
4. For OCX controls that never receive the focus, find another way. Vlad suggests the following: "Assuming that you don't want to set it at the beggining of you app, I would say that you should have a global var or app property to keep the number of active OCX that need Autoyield = .F. You should increment it in Init and decrement it in Destroy. The ocx that decrements it to zero, resets it to .t."

Another approach to 3 and 4 should be to add an lAutoYield property to the container or form that contains the .OCX and add the following code in the INIT()
*-- CHANGE - JCM - November 27, 1997 - 09:38:09
*-- this form contains an ActiveXControl that behaves much better
*-- with AutoYield set to .F.

this.lOldAutoyield = _VFP.AutoYield

IF this.lOldAutoYield = .T.
_VFP.AutoYield = .F.
ENDIF

DODEFAULT()
*-- ENDCHANGE - JCM - November 27, 1997 - 09:39:53


And the container or Form DESTROY()
*-- CHANGE - JCM - November 27, 1997 - 09:38:09
*-- this form contains an ActiveXControl that behaves much better
*-- with AutoYield set to .F.
*-- Reset this property to its old value

IF _VFP.AutoYield # this.lOldAutoyield
_VFP.AutoYield = this.lOldAutoyield
ENDIF

DoDefault()
*-- ENDCHANGE - JCM - November 27, 1997 - 09:39:53

What do you think?

José
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform