RawKeyDown and focused object: something fishy
Posted: Sun Mar 24, 2024 6:08 pm
Hello.
You may find the attached test stack a little strange (tested only on OSX as of now, LC10,OSX14.3.1).
This stack is useful to me to test a string keyboard input packet, of a fixed lenght, defined as such because of the first chosen char, while having in the card other text input fields or focusable controls, where the user may be doing some activity.
In reality the string packet will be sent with Bluetooth from a HID device.
To test the stack:
1 - Open the stack on development
2 - press the "Chose BTcode char" button, typing a single char (for example "x")
3 - Mouse click on the card, so as to deselect everything (on the log the "focuseObject" will correctly write the card being focused)
PS: I always found this behaviour strange, since only controls with traversalOn property = true should receive focus...bah.
4 - Type "x" (or whatever your chosen char) followed by 4 other chars
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: same, correct
5 - Now go to card 2 (use the segment widget) and do again point 4 (Type "x" (or whatever your chosen char) followed by 4 other chars)
Note that on card 2 there are not focusable controls.
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: same, correct
NOW:
6 - back to card 1
7 - type something on the "Text Mac Fld" and leave there the insertion point
8 - Repeat point 4
OBSERVED RESULT: same, correct: even if the unlocked filed is selected, with an insertion point, the "Completed" response will be triggered
HERE WE GET TO THE POINT
9 - go to card 2 (you left the field of card 1 still focused)
10- Repeat point 4
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: no RawKeyDown input get received by the card
Note that "focusedObject" returns correctly the card name
I believe this last wrong behaviour depends somehow from not having a focusable object in the card. But still I don't understand why it works on points 5.
Also, if you repeat point 6-7-8 and you go to card 3, it will work just by having a focus on fld "TestField" and "Focus on nothing" on the on OpenCard,
Someone can explain me this behaviour and suggest some solutions?
Thanks
Trevix
You may find the attached test stack a little strange (tested only on OSX as of now, LC10,OSX14.3.1).
This stack is useful to me to test a string keyboard input packet, of a fixed lenght, defined as such because of the first chosen char, while having in the card other text input fields or focusable controls, where the user may be doing some activity.
In reality the string packet will be sent with Bluetooth from a HID device.
To test the stack:
1 - Open the stack on development
2 - press the "Chose BTcode char" button, typing a single char (for example "x")
3 - Mouse click on the card, so as to deselect everything (on the log the "focuseObject" will correctly write the card being focused)
PS: I always found this behaviour strange, since only controls with traversalOn property = true should receive focus...bah.
4 - Type "x" (or whatever your chosen char) followed by 4 other chars
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: same, correct
5 - Now go to card 2 (use the segment widget) and do again point 4 (Type "x" (or whatever your chosen char) followed by 4 other chars)
Note that on card 2 there are not focusable controls.
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: same, correct
NOW:
6 - back to card 1
7 - type something on the "Text Mac Fld" and leave there the insertion point
8 - Repeat point 4
OBSERVED RESULT: same, correct: even if the unlocked filed is selected, with an insertion point, the "Completed" response will be triggered
HERE WE GET TO THE POINT
9 - go to card 2 (you left the field of card 1 still focused)
10- Repeat point 4
EXPECTED RESULT: when the string is 5 chars long it will trigger the "Completed" response (see the log)
OBSERVED RESULT: no RawKeyDown input get received by the card
Note that "focusedObject" returns correctly the card name
I believe this last wrong behaviour depends somehow from not having a focusable object in the card. But still I don't understand why it works on points 5.
Also, if you repeat point 6-7-8 and you go to card 3, it will work just by having a focus on fld "TestField" and "Focus on nothing" on the on OpenCard,
Someone can explain me this behaviour and suggest some solutions?
Thanks
Trevix