"on enterKey" not working

Paul Gabel paulgabel at comcast.net
Sun Oct 14 18:34:00 EDT 2007


A big "thank you" to Randy Hengst, Jim Ault, Bjornke von Gierke,  
Sarah Reichelt, and Kay Lan.

Just to update you, I still cannot use "on enterKey" effectively.  
This is the handler I want to place at the card level ...

on enterKey
   click at the loc of btn "Continue"
end enterKey

The problem isn't that I can't tell the Enter Key from the Return  
Key, as was suggested (I've been using a Mac since 1984). The problem  
isn't lockMessages, since it's reset to false at the end of each  
handler. The problem isn't default buttons, because I don't have any  
set on the card I'm experimenting on.

I commented out every "on enterKey" in my 3 stacks and put Jim's  
suggestion ...

on enterkey
   answer "you are in the stack script, and a bit too far into the  
heirarchy"
end enterkey

... in my mainstack. It brings up the answer dialog box all right.

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.

Paul Gabel




More information about the use-livecode mailing list