Page 1 of 1

mouseClick ignored

Posted: Tue Nov 13, 2012 6:56 pm
by JackD
I included code to cycle through the cards in a stack with a mouseClick to exit the repeat loop. It works fine on my Mac but when I try it in the iOS simulator or on my iPad, it never exits the loop. The code below is a simplified version that I put into a stack with no other scripts to make sure I wasn't trapping the click somewhere but it doesn't work either. According to the LiveCode dictionary this is supposed to work on iOS devices. Is there some other way out of the loop?

Code: Select all

on mouseUp
   repeat
      go next card
      if mouseClick() then exit repeat
      wait 1 second
   end repeat
end mouseUp

Re: mouseClick ignored

Posted: Tue Nov 13, 2012 6:59 pm
by jmburnod
Hi JackD,

Try:

Code: Select all

wait 1 second with messages
(no tested)

Re: mouseClick ignored

Posted: Tue Nov 13, 2012 7:13 pm
by jacque
If the click does not happen exactly when that line of code checks for it, the click won't be recognized. It's usually a bad idea to check for a mouseclick within a repeat loop, especially a long loop. Using a "send <message> in <time>" construct is the general way to do this sort of thing. See also: http://www.hyperactivesw.com/polling.html

Re: mouseClick ignored

Posted: Tue Nov 13, 2012 10:56 pm
by JackD
Thanks Jacque & jmburnod. It looks like wait ... with messages does what Jacque is suggesting without additional code. I was not aware of that option.

Re: mouseClick ignored

Posted: Wed Nov 14, 2012 10:20 am
by jmburnod
Here is a stack in attachment with an loop example that use a pendingmessage "go next cd"