AutoYield, DoEvents
This property and its related command control the interaction between VFP and ActiveX controls.
Usage |
appApplication.AutoYield = lYield lYield = appApplication.AutoYield DoEvents |
Parameter |
Value |
Meaning |
lYield |
.T. |
This is the default setting, and the mode of Visual FoxPro 3. Windows events are processed as they are received, meaning the operator can interrupt your code. |
.F. |
Use this setting if ActiveX controls on your forms need to run your custom code. |
Example |
_VFP.AutoYield = .F. FOR nCount = 1 TO nSomeInsanelyLargeNumber * Do the normal processing for this loop. * Now check for user events. IF MOD(nCount,100) = 0 DoEvents * If user canceled, get out. IF LASTKEY()=27 EXIT ENDIF ENDIF ENDFOR * Check to see if the Cancel button was pressed while * processing in a loop. First, check to see if the mouse button * was pressed. If so, see if the control the mouse is currently * over is the button named cmdCancel. If so, use DOEVENTS to * handle the click of the button. IF MDOWN() loControl = SYS(1270) IF TYPE('loControl.Name') = 'C' AND ; UPPER(loControl.Name) = 'CMDCANCEL' DoEvents ENDIF ENDIF |
See Also |