Page 1 of 1
returnInField or enterinField looses Functinality of key in
Posted: Fri Jun 26, 2015 10:29 pm
by sphere
Hello,
when i use this piece of script in a field:
Code: Select all
on returnInField
send mouseUp to button"set" of card 2
focus on nothing
end returnInField
on enterInField
send mouseUp to button"set" of card 2
focus on nothing
end enterInField
then hitting the Enter key on my pc is going to this script and gives an error.
this happens everywhere, in every script.
even when creating the standalone app and popup messages come up, they will not respond anymore to the Enter key(except clicking on OK with the mousy)
it will stop when i put # in front of every line and activate the script
I use both enter and return as i don't know which key is responding to the hook (return sign) on android keyboard
Anyone else can confirm?
Thanks! (i'm using lc 7.06 rc2)
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 4:09 am
by Randy Hengst
try this
send “mouseUp” to button “set” of card 2
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 11:32 am
by sphere
It's not the problem that when hitting Enter/Return does not go to the button, because that is working correct.
It's the problem that now anywhere in the development environment hitting Enter/Return is causing an error and points to the script.
Even when the program is not running.
So you can enter a new line of script somewhere, but as soon as you hit the Enter key to go to the next line it causes an error.
Byt the way, what is the difference between mouseUp and "mouseUp" ?
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 12:32 pm
by Randy Hengst
Then I'll bet the button is a "default" style and is being activated when you hit return/enter. Turn off its default setting under the Basic Properties pane... near the bottom.
See SEND in the dictionary for some information about "mouseUp" in quotes.
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 6:51 pm
by sphere
i checked and the default was not checked.
And hounestly i don't get the explanation quite of the meaning with the quotes.
I understand that if you want to send something with it where you send it to then you need quotes, for only example "mouseUp"i don't understand the difference
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 7:11 pm
by jacque
When sending a message, the message is a literal text string and should be in quotes. If there is only one word, like "mouseUp" then LC will interpret that as a string after first checking to see if there is a variable of that name. If there is no variable then it decides "mouseUp" is a string and sends that. You should always quote the strings you are sending to another object. This is especially important if you are including a parameter. Without the quotes, the parameter will fail:
should be:
The only way your script would interfere with other handlers is if it is not really in the field itself, or if it has been set up as a frontscript. If you want to post your stack we can take a look.
Re: returnInField or enterinField looses Functinality of key
Posted: Sat Jun 27, 2015 10:38 pm
by sphere
Thank you Jacque for your explanation, really appreciated.
I changed it and now with quotes, i made the button invisible, because when htting return then there is no need to push the button.
It's working well
So actually were helping the engine when using quotes that it don't have to check for a variable.
Great!
Thanks a lot !
Re: returnInField or enterinField looses Functinality of key
Posted: Sun Jun 28, 2015 5:21 am
by SparkOut
Just as a tangent, is there any reason why you are using "send" at all, given the invisible button?
You could have a handler containing the script from the button (placed, say, in the card or stack script). Then just call the handler from the enterInField script in place of sending a mouseUp to the button. If you want to use the button as well, for manually testing, replace the script in the mouseUp to be a statement which fires the same handler you created earlier.
Re: returnInField or enterinField looses Functinality of key
Posted: Sun Jun 28, 2015 9:41 am
by sphere
Yes thanks Sparkout, i even removed the button and it's script, and putted that part of the script into the field script, because when hitting return there is no need to push the button.
it works great, even then i use a send command to activate a handler on the card script.