Condividi tramite


AutoYield Property

Specifies whether an instance of Visual FoxPro processes pending Windows events between execution of each line of user program code.

ApplicationObject.AutoYield[ = lExpr]

Property Values

  • lExpr
    Specifies whether an instance of Visual FoxPro processes Windows events between each line of user program code. lExpr can be one of the following logical values:
    lExpr Description
    True (.T.) (Default) The instance of Visual FoxPro processes pending Windows events between execution of each line of user program code.

    If lExpr is set to true (.T.), the instance of Visual FoxPro processes pending Windows events in the same manner as earlier versions of Visual FoxPro.

    False (.F.) The instance of Visual FoxPro does not process pending Windows events between each line of user program code.

    All pending Windows events are placed in a queue, and the events in the queue are processed when DOEVENTS is issued or a wait state occurs. A wait state occurs when Visual FoxPro is waiting for input from the user. The WAIT command does not create a wait state.

Remarks

The AutoYield property should be set to false (.F.) when a form contains an ActiveX control. Setting AutoYield to false (.F.) prevents events for an ActiveX control from executing between lines of user program code. For example, if AutoYield is set to true (.T.), clicking an ActiveX control while user program code is executing may cause an event for the ActiveX control to execute, ignoring the user program code for the event, producing undesirable or unpredictable results.

The following occurs when the AutoYield property is set to false (.F.):

  • ActiveX controls cannot process events until a wait state occurs, so clicking an ActiveX control has no effect while user program code is executing. This is the same behavior for Visual FoxPro controls such as the Grid.
  • ON KEY LABEL commands and mouse events are ignored while user program code is executing. The ON KEY LABEL commands and mouse events are placed in a queue and processed at the next wait state.
  • Pressing Esc does not interrupt program execution. This is identical to setting ESCAPE to OFF. In this case you cannot exit infinite loops without shutting down the instance of Visual FoxPro.
  • Queries cannot be interrupted.
  • Switching to other applications is supported, but you cannot switch back to Visual FoxPro while Visual FoxPro user program code is executing.

See Also

DOEVENTS Command | WAIT Command | ON KEY LABEL Command

Applies To: Application Object | _VFP System Variable