Tracing Function Help
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Tracing Function Help
Hey I'm new to livecode and I recently called RunRev who told me about a tracing function that will allow a user to draw with the touch screen. I am trying to make an app in which the user would sign his/her name with the trace function and a screen of the image would be taken and saved with information that user filled out. If someone would explain to me how tracing function works and give me some example code that would be brilliant.
Re: Tracing Function Help
There is no built-in tracing function, so they must have meant a script you could write. It would keep track of the mouse/touch locations at short, regular intervals, accumulating a list of points. Then it would set the points of a polygon to the list of locations you've recorded. If I had more time I'd dig for some examples I made years ago; maybe someone else has time to do it. Basically you fire off repeated checks every few milliseconds and grab the mouseloc during each check, adding each new mouse location to a list in a variable. Then set the points of a polygon to that list.
When the user is done "drawing" you can make a screenshot of the area using the "import snapshot" command, then do whatever you want with that image.
When the user is done "drawing" you can make a screenshot of the area using the "import snapshot" command, then do whatever you want with that image.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
Code: Select all
local sMouseIsDown
## While the user is holding the mouse down draw a polygon by setting the points
on mouseDown
set the style of the templateGraphic to "polygon"
create graphic "sig"
put true into sMouseIsDown
end mouseDown
on mouseMove x,y
if sMouseIsDown then
put the points of graphic "sig" into tPoints
put return & x,y after tPoints
set the points of graphic "sig" to tPoints
end if
end mouseMove
on mouseUp
put false into sMouseIsDown
end mouseUp
Re: Tracing Function Help
Hi wolfkillshepard,
Maeby this script help you.
Best regards
Jean-Marc
Maeby this script help you.
Code: Select all
local sMouseIsDown
## While the user is holding the mouse down draw a polygon by setting the points
on mouseDown
set the style of the templateGraphic to "polygon"
--create graphic "sig"
create graphic
put true into sMouseIsDown
end mouseDown
on mouseMove x,y
if sMouseIsDown then
--put the points of graphic "sig" into tPoints
put the points of last graphic into tPoints
put return & x,y after tPoints
--set the points of graphic "sig" to tPoints
set the points of last graphic to tPoints
end if
end mouseMove
on mouseUp
put false into sMouseIsDown
end mouseUp
Jean-Marc
https://alternatic.ch
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
Thank you sooooo much that's perfect!
Re: Tracing Function Help
Hi wolfkillshepard
Next step : How the user erase a grc ?
Best
Jean-Marc
WelcomeThank you sooooo much that's perfect!
Next step : How the user erase a grc ?
Best
Jean-Marc
https://alternatic.ch
Re: Tracing Function Help
Bonjour Jean-Marc.
...
delete grc X
...
Or do you mean how the user will be able to delete a graphic?
What about a doubleclick with an modifier key like ALT?
but beware, this cannot be in the script of the graphic that will ge deleted!
Put soemthing like this into the card script:
Best
Klaus
...
delete grc X
...
Or do you mean how the user will be able to delete a graphic?
What about a doubleclick with an modifier key like ALT?
but beware, this cannot be in the script of the graphic that will ge deleted!
Put soemthing like this into the card script:
Code: Select all
on mousedoubleup
if the ALTkey = "down" AND word 1 of the name of the target = "graphic" then
## Maybe add confirmation dialog:
## Answer "Really delete this nice graphic?" with "No" or "OK"
## if it = OK then
delete the target
## end if
end if
end mousedoubleup
Klaus
Re: Tracing Function Help
Guten Abend Klaus,
Sorry for my poor english.
My question was about the interface (how the user can erase one grc)
I think a tools palette should be very useful (erase,editPoints,grab,setlinesize etc...)
Best from Geneva Beach
Jean-Marc
Sorry for my poor english.
My question was about the interface (how the user can erase one grc)
I think a tools palette should be very useful (erase,editPoints,grab,setlinesize etc...)
Best from Geneva Beach
Jean-Marc
https://alternatic.ch
Re: Tracing Function Help
Bonjour Jean-Marc,
ah, looks like I misunderstood you, but not cempletely
Yes, in these cases a TOOLS palette is a MUST, otherweise the user will have no way to "switch" tools!
Best
Klaus
ah, looks like I misunderstood you, but not cempletely

Yes, in these cases a TOOLS palette is a MUST, otherweise the user will have no way to "switch" tools!
Best
Klaus
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
Hey guy's I know this thread hasn't been visited in a while but after doing some more testing, this drawing function isn't as smooth as I would like it to be on iOS. When signing your name its a lot less smooth on the actual phone than when on a computer. If you have an idea about how to make it good enough to the extent where I can sign a legible signature with a stylus I would really appreciate it!
Thanks!
Thanks!
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
I also noticed a lag time when you start to draw, its like it doesn't start the code under the mouseUp on the drawing space for a second or 2, then you can actually create a graphic on the page.
Re: Tracing Function Help
Hi wolfkillshepard
Sorry no idea at this moment.
Best regards
Jean-Marc
Sorry no idea at this moment.
Best regards
Jean-Marc
https://alternatic.ch
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
How about you Klaus? Any ideas?
Re: Tracing Function Help
Hi guys,
sorry, no idea, except that LiveCode might not be the right tool for this task (yet?)!
Best
Klaus
sorry, no idea, except that LiveCode might not be the right tool for this task (yet?)!

Best
Klaus
-
- Posts: 44
- Joined: Tue Jul 12, 2011 7:43 pm
Re: Tracing Function Help
Thanks for taking a look none the less. I hope I can find some alternative to using that method to get a signature out.