Capturing user signature

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
ewansmac
Posts: 15
Joined: Tue Oct 25, 2011 7:59 am

Capturing user signature

Post by ewansmac » Thu Oct 04, 2012 9:45 am

I am developing an app that will be deployed on both ios and android and I require to capture a users signature. Is this possible and can anyone help.

Thanks

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Capturing user signature

Post by Dixie » Thu Oct 04, 2012 11:26 am

Hi..

Yes it is possible.. I have attached a stack that will show you the basics... just write your name or signature on the card, or screen if on your device...once you have the 'signature' export the snapshot of the graphic to a file and then you could do with it what you will..:-)

hope it helps

Dixie
Attachments
Draw.livecode.zip
(1.77 KiB) Downloaded 294 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Capturing user signature

Post by Mark » Thu Oct 04, 2012 12:43 pm

Hi,

I can't open Dixie's stack, because I'm LC 5.0.2 and he might be using a newer version of LC. Therefore, I'll post my solution anyway.

My first attempt used mouseDown and a repeat loop until the mouse is up, but that doesn't work on tablets (with LC 5.0.2). Therefore I am using the mouseStillDown message.

Code: Select all

local lPoints

on mouseStillDown
     put the mouseLoc into myLoc
     if myLoc is within the rect of btn "Canvas" then
          put myLoc & cr after lPoints
          set the points of grc 1 to lPoints
     end if
end mouseStillDown

on mouseUp
     put cr after lPoints
end mouseUp
You need a graphic object of type polygon and one transparent button "Canvas" on top of it. Set the script of the button (or card) to the script posted here. The scripts is very slow, but it kind of works. I look forward to seeing better solutions.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Capturing user signature

Post by Dixie » Thu Oct 04, 2012 1:04 pm

'Draw' stack saved in legacy format...
This is the very basics of the 'skribble' app
Dixie
Attachments
Draw legacy.livecode.zip
(1.8 KiB) Downloaded 257 times

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Capturing user signature

Post by Mark » Thu Oct 04, 2012 1:35 pm

Thanks, Dixie. The mouseMove handler is indeed much faster than mouseStilldown.

I have created a simple stack, which can be built into other stacks. Download it here. It also contains a number of resizing routines for different devices. Use the following syntax from the message box:

Code: Select all

set the screenSize of this stack to "iPhone"
set the screenSize of this stack to "Android7"
set the screenSize of this stack to "iPad Retina"
Devices currently supported are: iPhone, iPad, Android7 (7"), iPod, iPhone Retina, iPad Retina.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply