Page 1 of 1

This code doesn't work in LC Web?

Posted: Tue Dec 21, 2021 11:34 am
by williamdesmet
Hi there,

I am testing some parts of one of my iPad apps in Livecode Web.
Why doesn't this work in Web?
Code is in grc "w1"

Code: Select all

on mouseup
   send drawline to me in 1 millisec
end mouseup

on mousedown
   grab me
   send drawline to me in 1 millisec
end mousedown

on mousemove x,y
   if the mouseloc is within the rect of grc "w1"
   then
      send drawline to me in 1 millisec
   end if
end mousemove

on drawline
   lock screen
   put the loc of grc "w1" into tLoc1
   put the loc of grc "s1" into tLoc2
   set points of grc "l1" to tloc1 & return & tLoc2 
   relayer grc "l1" to back of this card
   unlock screen
end drawline
Greetings,

William

Re: This code doesn't work in LC Web?

Posted: Sat Jan 15, 2022 12:01 am
by prometheus
You should edit your your code to look like this below, Note missing quotes ("drawline"), also be sure to set the style of your graphic controls to polygon

Code: Select all

on mouseup
   send "drawline" to me in 1 millisec
end mouseup

on mousedown
   grab me
   send "drawline" to me in 1 millisec
end mousedown

on mousemove x,y
   if the mouseloc is within the rect of grc "w1"
   then
      send "drawline" to me in 1 millisec
   end if
end mousemove

on drawline
   lock screen
   put the loc of grc "w1" into tLoc1
   put the loc of grc "s1" into tLoc2
   set points of grc "l1" to tloc1 & return & tLoc2 
   relayer grc "l1" to back of this card
   unlock screen
end drawline

Re: This code doesn't work in LC Web?

Posted: Sun Jan 16, 2022 12:02 pm
by williamdesmet
It still doesn't unfortunately.

Square "w1" (red) can be moved around the screen.
Graphic "l1" is the line between "w1" and "s1" and always stays centered.
It works OK in the IDE. Not working in LC Web 10 RC1 and 9.9.6 RC1.

Re: This code doesn't work in LC Web?

Posted: Sun Jan 16, 2022 1:49 pm
by prometheus
Could you tell which operating system you use? . I just test it on windows and works perfectly and smoothly

Re: This code doesn't work in LC Web?

Posted: Sun Jan 16, 2022 2:56 pm
by williamdesmet
I am on macOS Big Sur 11.5.2 and tested on Safari 14.1.2, FireFox 96.0.1. and Chrome 97.0.4692.71.
Firefox works the first time but moving the red square too fast makes the page become irresponsive.
Safari works only the first movement and then stops.
Chrome doesn't work at all.

LC 9.9.6 (RC1) gives this error in the message box:
exit(9486744) implicitly called by end of main(), but noExitRuntime, so not exiting the runtime (you can use emscripten_force_exit, if you want to force a true shutdown)