chasing the focus
Slava Paperno
slava at lexiconbridge.com
Mon Jul 4 23:49:25 EDT 2011
I'm trying to figure out why a field is losing focus and I don't know which
tools to use for the hunt.
At the very end of a mouseUp handler of a button I have this:
on mouseUp
.....
focus on field "SearchTarget"
put the name of the focusedObject & cf after msg
end mouseUp
And I do see [field "SearchTarget"] in the Message box, as expected. But
then focus immediately shifts to the card. I know that because I added an
idle handler to the card script:
on idle
put the name of the focusedObject & cf after msg
end idle
And I see this in the Message box:
field "SearchTarget"
card "MainCard"
card "MainCard"
card "MainCard"
etc.
So I know that the focus is on the field for a moment, and then leaves the
field and switches to the card. But I don't understand why this happens. I
don't have any code that executes after the end of that mouseUp. Breakpoints
and the Message Watcher are no help. How can I find out what's happening?
The vexing thing is that I think this wasn't happening yesterday... What can
it be?
The field is focusable and not locked, and if I click in it, I can input
text. In fact, I can remedy this situation by this kludge:
on idle
if the short name of the focusedObject is "MainCard" then
focus on field "SearchTarget"
end if
end idle
But I don't like that kludge. Any insights would be very welcome.
Slava
More information about the use-livecode
mailing list