[Gambas-user] WAIT in sub reverses number

Doriano Blengino doriano.blengino at ...1909...
Fri Jun 5 07:21:16 CEST 2009


Ken Thornton-Smith ha scritto:
> I'm  entering numbers from an RFID tag reader into a text box.
> A keypress event here opens another text box and moves cursor focus.
>
> Obviously, the first character opens the second textbox and the rather  
> slow usb puts the remaining characters in the second box.
> Being lazy, instead of looking for the complete string, I put in WAIT  
> 0.5.
>
> This enters the correct string but the string is now in the first box  
> in reverse.
> Keyboard entry has a similar effect.
>
> Gambas 2, no code necessary, works on two machines in any text box.
>
> Any theories?
>   
I am not sure to well understand, but it seems that, for every 
character, the first textbox looses focus and gains it again. This moves 
the text cursor at the beginning, so arriving characters are stored in 
reverse order. Is it this that happens?

You can put PRINT statements in the event handlers to trace what 
controls take focus (and hence, the arriving characters). You can use 
Application.ActiveControl to know, at any time, what control has the focus.

Anyway, try to use a single-shot timer instead of a WAIT: it could 
behave differently.

Hope this helps,

-- 
Doriano Blengino

"Listen twice before you speak.
This is why we have two ears, but only one mouth."





More information about the User mailing list