Using the Yield() Subroutine (Functions/Subroutines/Programs)

Yield() is designed to allow users to cancel out of loops that may take a long time to generate.  For example:  Looping through a table that has a large number of records can take quite a long period of time to generate.  Yield() will allow you to cancel the process and proceed with the rest of the program.

 

Yield() is not a function that you pass parameters to.  It actually checks the queue for events that need to be processed.

 

Example:

**This routine starts a form that was made in form designer that has only a cancel button on it.  The button s only function is to close the form.  Next the routine is going through a loop 500 times and checking to see if the form still exists.   **Start the cancel window** dlg = Start_Window( CANCELWIN ,   ,   ,   ,   ) for x = 1 to 500 YIELD()             **Checking to see if the window was closed** IF Get_Property(dlg, 'HANDLE') THEN             x = x + 1 END next x               This example is in a very simple form and can be used in much more complex and larger programs.  

  • kb/kb_articles/kb0119.txt
  • Last modified: 2024/01/30 13:36
  • by 127.0.0.1