mouseClick ignored

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

mouseClick ignored

Post by JackD » Tue Nov 13, 2012 6:56 pm

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
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: mouseClick ignored

Post by jmburnod » Tue Nov 13, 2012 6:59 pm

Hi JackD,

Try:

Code: Select all

wait 1 second with messages
(no tested)
https://alternatic.ch

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

Re: mouseClick ignored

Post by jacque » Tue Nov 13, 2012 7:13 pm

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
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

JackD
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 28
Joined: Sat Mar 14, 2009 3:17 am

Re: mouseClick ignored

Post by JackD » Tue Nov 13, 2012 10:56 pm

Thanks Jacque & jmburnod. It looks like wait ... with messages does what Jacque is suggesting without additional code. I was not aware of that option.
27" iMac, OS X 10.13
iPad 3, iPad Pro, iPhone 4s, iPhone 6, LG Optimus L9 phone, Samsung Galaxy Camera
LiveCode 8.1.9

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: mouseClick ignored

Post by jmburnod » Wed Nov 14, 2012 10:20 am

Here is a stack in attachment with an loop example that use a pendingmessage "go next cd"
Attachments
PendingMessageGoNextCD.livecode.zip
(1.51 KiB) Downloaded 255 times
https://alternatic.ch

Post Reply