Script runs only after button tapped twice?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Rod Edwardson
Posts: 23
Joined: Sun Mar 03, 2013 1:09 am

Script runs only after button tapped twice?

Post by Rod Edwardson » Sun Jun 16, 2013 5:13 pm

Hello all

Can anyone tell me why this script will only run after the button is tapped twice? The answer is probably obvious but I'm at a loss. Thanks in advance.

Code: Select all

on mouseUp
   if the environment = "development" then touchEnd 1
 
  lock screen
   focus on nothing
   find empty
   put false into tExit 
   find word"test"in field "Field b"
if the foundChunk is empty then 
 put true into tExit 
 else 
replace the foundText with "replaced text"in field "Field b"

end if
Rod

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10305
Joined: Wed May 06, 2009 2:28 pm

Re: Script runs only after button tapped twice?

Post by dunbarx » Sun Jun 16, 2013 5:47 pm

Hi.

There is nothing wrong with this script, although I have no idea what happens in the handler you call. In my simple test, I simply wrote

on touchEnd var
end touchEnd

Just so the script would run. You might check that handler.

Craig Newman

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

Re: Script runs only after button tapped twice?

Post by jacque » Sun Jun 16, 2013 7:29 pm

What's in the touchEnd handler?

In general I never use the "touch" messages, they're just duplicates of the mouse messages. Since the engine always sends both on mobile, it seems to me that your script should actually execute twice there, unless the touch handler exits to top. If you do want to use touchEnd for some reason, check to see what environment you're in and only use touchEnd if it's mobile:

Code: Select all

if the environment = "mobile" then
  touchEnd 1
else
  lock screen
  focus on nothing
  ... etc
end if
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply