autoHilite and focus (following Jacque's solution)
slava at lexiconbridge.com
Wed Jul 6 02:06:29 CDT 2011
My user types a search target and presses Enter or clicks the Find button,
and his target is found. At that point I want the focus to return to the
input field so the user can type another target. I find this surprisingly
difficult to achieve.
At the bottom of the mouseUp handler on the Find button, I had the
focus on field "SearchTarget"
Yet I found that as soon as the mouseUp was done, the focus was transferred
to the card itself.
This morning Jacque offered a brilliant explanation for that mystery: my
Find button had its Auto Hilite property set to true. I set it to false, and
lo and behold, the focus followed orders.
The only stated purpose of the autoHilite property is that it makes the
button provide visual feedback when clicked. I couldn't see the connection
between that and the focus being hijacked by the card, but all right, I had
the thing working.
But then I added other buttons to the same card, and found that if any of
them has AutoHilite set to true, my focus command is undone, and the focus
moves to the card itself as soon as the mouseUp handler is done in the Find
button. I do want the user to see the visual feedback from those buttons,
and I don't want their Focus with Keyboard property set to true.
With the focus gone, my user will probably try to press Tab to return the
focus to the input field. But when the focus is on the card, none of my
buttons receives that Tab keypress.
Is there no way to achieve what I want (see first sentence of this email)?
More information about the use-livecode