Text field in Windows standalone not receiving keyboard focus
curry at pair.com
Thu Jan 28 17:49:56 EST 2021
> You can click in the field and the blinking I-bar is inserted,
> but typing on the keyboard does nothing.
I love field topics!
Win/Mac differences can really hit you, even on a stack that you thought
was well-tested. Because only well-tested on one platform.
This glitch sounds familiar from the past, but I've had less Mac work
than usual for the past few months; mostly Windows. Rusty this month.
I think I've seen this, but can't remember the cause.
I've seen cases where the app or stack would lose focus.
Other cases where the control itself loses focus.
On Windows, a button may get the focus depending on properties.
But usually you would lose the blinking.
And I've seen scripts intercept the keystrokes.
They may act differently per platform.
To diagnose it methodically, if blinking really continues during typing:
- add a keydown handler in the field. Is it received?
- add a keydown handler in the card. Who's the target?
- any front script or other library intercepting keystrokes?
- any behaviors?
Knowing what control is actually getting those keystrokes will lead you
to the culprit. (Or even whether your stack/app is getting them.)
And if the normal culprits are exonerated, don't forget the more obscure
and exotic possibilities:
- white text, or textshift?
- text added but clipped by a tabstop?
- does all your startup code get executed? (And preopencard/stack code?)
- is this a real Windows machine or virtualized setup?
(Weird things can happen if a startup-type script is interrupted
silently by an error.)
> This ONLY happens in executable on Windows, not in IDE
That's always the biggest tip-off.
So unless it's an LC bug/glitch, this can be effective:
- check standalone inclusions
- add error reporting to the standalone
Without reporting, errors in exe are silent - and you might say, deadly.
After an error, any code after it is not executed.
> Pasting text into any of these fields seems to unlock the ability
> to type, as does switching to another application and switching back,
> but only until you leave the card and come back again.
That's a big tip-off too. Any card script? Any paste script?
There may be a script modifying a field property.
Or another control getting in the way.
All those can be tested and confirmed. You can log field properties.
When you find it, could you let me know?
I feel like I've seen this before. and would like to job my memory....
Custom Software Development
"Better Methods, Better Results"
LiveCode Training and Consulting
More information about the use-livecode