returnInField or enterinField looses Functinality of key in

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

returnInField or enterinField looses Functinality of key in

Post by sphere » Fri Jun 26, 2015 10:29 pm

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)

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 157
Joined: Thu Jun 29, 2006 4:16 pm

Re: returnInField or enterinField looses Functinality of key

Post by Randy Hengst » Sat Jun 27, 2015 4:09 am

try this

send “mouseUp” to button “set” of card 2

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: returnInField or enterinField looses Functinality of key

Post by sphere » Sat Jun 27, 2015 11:32 am

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" ?

Randy Hengst
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 157
Joined: Thu Jun 29, 2006 4:16 pm

Re: returnInField or enterinField looses Functinality of key

Post by Randy Hengst » Sat Jun 27, 2015 12:32 pm

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: returnInField or enterinField looses Functinality of key

Post by sphere » Sat Jun 27, 2015 6:51 pm

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

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: returnInField or enterinField looses Functinality of key

Post by jacque » Sat Jun 27, 2015 7:11 pm

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:

Code: Select all

send mouseUp 3 to button "foo"
should be:

Code: Select all

send "mouseUp 3" to button "foo"
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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: returnInField or enterinField looses Functinality of key

Post by sphere » Sat Jun 27, 2015 10:38 pm

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 !

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: returnInField or enterinField looses Functinality of key

Post by SparkOut » Sun Jun 28, 2015 5:21 am

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.

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am

Re: returnInField or enterinField looses Functinality of key

Post by sphere » Sun Jun 28, 2015 9:41 am

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.

Post Reply