I got it now. :) Here's an idea:
Use a timer instead of your DO WHILE NOT llCommandButton ... ENDDO.
In the timer's TIMER method:
IF CHRSAW()
*-- There still are chars in the keyboard buffer.
* Do nothing... or do something to see why the
* chars are still there... etc.
ELSE
*-- Turn off the timer and:
pFillTextBoxes() && Or whatever you want to do while not stuffing keys in the keyboard buffer...
*-- Turn on the timer.
ENDIF
Use a timer with an Interval of 200 or higher.
I didn't try it, but it may work.
Vlad
>I'm working worth a page of a pageframe and based on what type of text box is there I want to format my input accordingly.
>
>
>LOCAL llCommandButton
>llCommandButton = .F.
>DO WHILE NOT llCommandButton
> llCommandButton = fFillTextBoxes()
>ENDDO
>
>PROCEDURE pFillTextBoxes
>#DEFINE kcTab CHR(9)
>LOCAL loCurObj, llCommandButton, lcKeyBoard
>
>loCurObj = _SCREEN.ACTIVEFORM.ACTIVECOTROL.
>
>* Now get the type from the control source.
>* Get the name
>.
>llCommandButton = .F.
>DO CASE
> CASE < commandbutton >
> llCommandbutton = .T.
> CASE TYPE < numeric >
> lcKeyBoard = "10"
>ENDCASE
>
>KEYBOARD lcKeyBoard + kcTab
>
>RETURN llCommandButton
>
>
>
>The point of the code is that I won't know what is on the page prior to running the code. Your keyboard example may not work for specific textboxes. This is a kind of programmatic interactive tester that based on the type of the control box, I will keyboard certain values. Now granted certain fields need special handling. But I am working on something that will do special handling based on properties and methods in the objects that I am looking at.
>
>In this kind of loop I need to keyboard. Get control back in the program. Keyboard again. And finally have some way of stopping. Here I am making an assumption that after tabbing through a number of fields, I will reach a command button and stop execution of the test. The test must run by itself. Eventually we plan to have it run a number of screens to simulate data-entry on several different machines for a more severe stress test.
>
>I have looked at DOEVENTS that does kick out the whats stuffed in the keyboard buffer, but unfortunately it has a lot of unwanted side effects as well
>
>I appreciate your comments VLAD. Any help you can give me with this problem would be greatly appreciated.
>
>Dan