readonly not respected for first keydown

I am using current XOJO and current PC and Mac OS’s.
I have a second window that has all of its textareas as readonly and are verified as such in the debugger. I have set no control to receive focus (I have also tried it with focus on the window and various controls). The first action that I make specifically is Keyboard.AsyncKeyDown(123) or Keyboard.AsyncKeyDown(124). This first action never gets processed. The second keypress does but only after a button is pressed. I have seen on Windows the cursor move over the text in a readonly textarea. On a Mac nothing happens until I press a button.
Suggestions?

AsyncKeyDown does not plug keys, it just detects them.

http://documentation.xojo.com/index.php/keyboard

What are you trying to achieve ?

Sorry. I guess Keyboard.AsyncKeyDown(123) or Keyboard.AsyncKeyDown(124) isn’t clear.
The first actions I make are either pressing the right or left arrow keys. Nothing happens until I press a button.

In the boot password, usually, my first key down is not detected: I have to wait some seconds befrore pressing a key (the password)… *

Did you try to wait some seconds before pressing any key ?

  • If I have the virtual keyboard on screen, the touch down (on a key) is correctly detected…

Thanks. That worked and I can accept that, but it doesn’t make sense since each key after that responds well for a debugger.
I’ll live with it.
The very confusing part is I can move the cursor in a readonly space.

That’s so you can select the text via the keyboard.

Post a simple test project that’s shows the problem and I’ll take a look

On this forum, you can select text from a post that you cannot amend. The text is read-only, but you can still interact with it.

If you really don’t want the cursor to go there, don’t use a textfield, use a label.

That is the reason I threw away my bluetooth keyboard. I never knew if the first key I pressed was going to appear on screen or just wake the keyboard up.

And, if for some reasion, you need to be able to copy the Label Caption (Text), you can add code on a MouseDown event to pass its Caption (Text) into the CLipboard :wink:

[quote=331854:@Arthur Gabhart]Thanks. That worked and I can accept that, but it doesn’t make sense since each key after that responds well for a debugger.
I’ll live with it.
The very confusing part is I can move the cursor in a readonly space.[/quote]

Arthur, where did you place your code ? That probably explains the issue.

You can also make the label selectable.

Thanks Greg, I do not checked before responding.

One think I like is to be able to copy the string from a MessageBox (when the program is running ! Nice / Better than screen shots for debug)

Thanks for your inputs. I solved my problem in a way I didn’t expect. I changed my textareas to tabstop=False in the inspector and my code worked.

[quote]Michel Bujardet
Arthur, where did you place your code ? That probably explains the issue.[/quote]
The code I quoted above (asynch…) is in my window’s keydown event.

Someone suggested above to change my textareas to labels. Thanks. I’ll work on that, since that is all I really need and it can accept mouseclicks.

Using AsyncKeydown in the keydown event is not the right way. Use the key property of the event instead.

Please explain. I am not sure what you mean.
I have the key input, which is an arrow, but what do I do with it?

In the KeyDown Event, the parameter is Key As String.

Key holds the ASCII value of the depressed Key

Fake code:
if Key = Asc(28) Then Left Arrow
if Key = Asc(29) Then Right Arrow
if Key = Asc(30) Then Top Arrow
if Key = Asc(31) Then Bottom Arrow