help me

If you find an issue in LiveCode but are having difficulty pinning down a reliable recipe or want to sanity-check your findings with others, this is the place.

Please have one thread per issue, and try to summarize the issue concisely in the thread title so others can find related issues here.

Moderator: Klaus

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

help me

Post by sunkim » Wed Jun 17, 2015 6:53 pm

hi everyone
I don"t know why
following script is work well on pc
but not work on the android phone

'repeat until the mouseClick'
or
'repeat until the mouseClick is true'

I have tested this script for many days
and I knew
"the mouseClick" function is not work on android
I think this problem may be error of Livecode
right?

anyone help me
warm regard

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: help me

Post by dave.kilroy » Wed Jun 17, 2015 7:53 pm

hi sunkim - actually the dictionary says the mouseClick as also available on Android...
"...this is not the code you are looking for..."

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

Re: help me

Post by sunkim » Wed Jun 17, 2015 9:50 pm

hi dave
would you give me a sample script?

I did some sample script in dictionary
but did not work on android
Last edited by sunkim on Wed Jun 17, 2015 9:54 pm, edited 1 time in total.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: help me

Post by dave.kilroy » Wed Jun 17, 2015 9:54 pm

hi sunkim - no, I think the best thing would be for you to post your script so we can see what you are trying to do and where any bugs might lurk that you've missed...

dave
"...this is not the code you are looking for..."

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

Re: help me

Post by sunkim » Wed Jun 17, 2015 9:58 pm

hi dave
it doesn't work very simple script like this

on mouseup
repeat until the mouseClick
beep
end repeat
end mouseup

what's wrong?
thank's your answer
sunkim
Last edited by sunkim on Wed Jun 17, 2015 10:10 pm, edited 1 time in total.

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

Re: help me

Post by SparkOut » Wed Jun 17, 2015 10:08 pm

If this is not a bug, then certainly it's a documentation error.
By default, errors on Android fail silently without explanatory messages. Using the mouseClick syntax never triggers the repeat loop. I therefore believe the mouseClick is not supported on Android, despite what the Dictionary says. I can sort of see why, since there is no mouse, but the mouse messages have been ported to the mobile platforms, so maybe this function has been overlooked.

Anyway, you can work around this issue by updating the card script to:

Code: Select all

on openCard
   set the cRunning of this card to true
   repeat until the cRunning of this card is false
      nextword
      wait for 100 milliseconds with messages
      --include "with messages" to make sure the engine has a chance to poll 
      --for interactive events without the repeat loop taking over all cycles
   end repeat
end openCard

on touchStart
   set the cRunning of this card to false
end touchStart
Last edited by SparkOut on Wed Jun 17, 2015 10:09 pm, edited 1 time in total.

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: help me

Post by dave.kilroy » Wed Jun 17, 2015 10:09 pm

hi sunkim - could you post some code that is actually from your stackfile - it makes a difference if you send actual code rather than pseudo code - if you send actual code we can see where bugs may be hiding - if you send pseudo code then we can't help (it's a bit like going to the doctor with a pseudo 'bad leg' - the doctor needs to see your actual, real 'bad leg')

So, why not zip up your stackfile and post it here?

Kind regards

Dave
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: help me

Post by dave.kilroy » Wed Jun 17, 2015 10:13 pm

well done sparkout - you were more helpful and more giving than me!
"...this is not the code you are looking for..."

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

Re: help me

Post by sunkim » Wed Jun 17, 2015 10:17 pm

hi dave

I'll try your code
and thanks lot your advice

sunkim

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: help me

Post by dave.kilroy » Wed Jun 17, 2015 10:19 pm

sunkim - it was sparkout and not me who posted code for you...
"...this is not the code you are looking for..."

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

Re: help me

Post by sunkim » Wed Jun 17, 2015 10:31 pm

hi sparkout
thanks lot
I'll try your code

sunkim

:mrgreen: my english is short

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: help me

Post by Simon » Thu Jun 18, 2015 12:53 am

I'm thinking the actual issue may have been the "beep" and a repeat loop with no delay.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

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

Re: help me

Post by SparkOut » Thu Jun 18, 2015 7:17 am

I didn't use beep but I did try it out, using the code structure sunkim requested help with in the original post on the same lines. The mouseClick definitely fails on Android. The repeat loop never even triggers.

sunkim
Posts: 23
Joined: Tue May 05, 2015 8:30 pm

Re: help me[solved]

Post by sunkim » Thu Jun 18, 2015 5:50 pm

hi SparkOut
thank you very much
your code worked well
my problem have solved by you
again thanks lot
thank everyone
:D

sunkim

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

Re: help me

Post by jacque » Thu Jun 18, 2015 7:20 pm

SparkOut's method is the recommended way to handle mouse events inside a repeat loop. I think "mouseclick" is supported on Android but isn't reliable inside a loop. I just did a quick Android test with this handler:

Code: Select all

on mouseUp
  repeat until the mouseclick
    put the seconds into fld 1
    wait 1 with messages
  end repeat
end mouseUp
The repeat loop does run for me and the seconds are updated as expected. But a tap does not exit the repeat, no matter where I tap on screen. If I had used "beep" instead of the seconds like the OP, expecially without any wait time, the overhead for the audio to load would take longer than the time for the next iteration of the loop, so I suspect that's why no beeps were heard.

Repeat loops shouldn't use the mouseclick as an exit test even on desktop apps because of the way LC tests for a click. If the click is not completed at the exact moment the test occurs, it will be missed. If you click while the interior of the loop is running, it won't always be recognized. On desktops it seems to be a little more reliable, maybe because those machines are faster, but it will still miss some clicks occasionally if the timing isn't exactly right.

There is more info here about testing for various mouse conditions: http://www.hyperactivesw.com/polling.html The example uses a mouseMove handler to explain, but a repeat loop should use the same method, just as SparkOut's solution does.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply