"on enterKey" not working

Sarah Reichelt sarah.reichelt at gmail.com
Sun Oct 14 20:09:08 EDT 2007


> All of this experimenting has led me to conclude that the problem
> involves "focus" and the "focusedObject" function. I have several
> controls on cards that users respond to. If the user (that's me in my
> experiments) enters text in a field or clicks on a radio button,
> these controls get the focus (typing "put the focusedObject" in the
> message box reveals this). But I can't set the focus to "none" (I
> tried), and I can't set the focusedObject to the card, where the "on
> enterKey" script resides (since it's a function, not a property). So
> it seems that after a user responds, some control will always have
> the focus, and, when I press the Enter Key, Rev sends the enterKey
> message to it instead of the card.
>
> I'm on the verge of abandoning "on enterKey," but if anyone has any
> more suggestions I'd love to hear them. Thank you again.
>

Two suggestions for you Paul:

1. Set the traversalOn of all buttons to false. It is used on Windows
where people tab through buttons, but on Macs, this is not needed, but
as you have observed, it does allow buttons to grab the focus.

2. Add an enterInField handler to your card script as well. This
should catch the key press when the focus is in a field.

Cheers,
Sarah



More information about the use-livecode mailing list