This code doesn't work in LC Web?

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 66
Joined: Tue Jun 26, 2012 7:07 pm

This code doesn't work in LC Web?

Post by williamdesmet » Tue Dec 21, 2021 11:34 am

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

prometheus
Posts: 40
Joined: Sun Dec 13, 2015 6:05 pm

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

Post by prometheus » Sat Jan 15, 2022 12:01 am

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

williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 66
Joined: Tue Jun 26, 2012 7:07 pm

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

Post by williamdesmet » Sun Jan 16, 2022 12:02 pm

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.
Attachments
Schermafbeelding 2022-01-16 om 11.57.18.png

prometheus
Posts: 40
Joined: Sun Dec 13, 2015 6:05 pm

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

Post by prometheus » Sun Jan 16, 2022 1:49 pm

Could you tell which operating system you use? . I just test it on windows and works perfectly and smoothly

williamdesmet
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 66
Joined: Tue Jun 26, 2012 7:07 pm

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

Post by williamdesmet » Sun Jan 16, 2022 2:56 pm

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)

Post Reply

Return to “HTML5”