Capture signature with Pad or Touchscreen

Capture signature with Pad or Touchscreen

Postby Gale FORd » Fri Oct 31, 2014 5:22 pm

Has anyone used a Pad or Touchscreen to capture a signature? I have tried the sample program in the samples folder but it does not work very will. I might have to look into the Inking routines in the development tools or an 3rd party ActiveX but was hoping someone else might have already tackled this.
Thanks
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Capture signature with Pad or Touchscreen

Postby Silvio.Falconi » Fri Oct 31, 2014 5:32 pm

there is a sample on fwh folder

here run ok
perkaps you must change

Code: Select all  Expand view
#include "FiveWin.ch"

function CaptureSignature()

   local oDlg, oSig, lPaint := .F., cFile := Lower( "signature.bmp" ), hDC

   DEFINE DIALOG oDlg TITLE "Signature" FROM 0, 0 TO 150, 350 PIXEL

   @ 15, 5 SAY oSig PROMPT "" SIZE 150, 40 PIXEL BORDER OF oDlg
   
   @ 01, 5 BUTTON "Clear" SIZE 25, 10 PIXEL ACTION oSig:refresh(.t.) OF oDlg
   
   @ 01, 60 BUTTON "Save" SIZE 25, 10 PIXEL OF odlg ;
      ACTION ( oSig:SaveToBmp( cFile ), oDlg:End() )

   oSig:lWantClick := .T.
   oSig:bLButtonUp := { | x, y, z | DoDraw( hDC, y+1, x+1, lPaint := .F. ) }
   oSig:bMMoved    := { | x, y, z | DoDraw( hDC, y, x , lPaint ) }
   oSig:bLClicked  := { | x, y, z | DoDraw( hDC, y, x, lPaint := .T. ) }

   ACTIVATE DIALOG oDlg CENTER ;
      ON INIT ( hDC := GetDC( oSig:hWnd ) ) ;
      VALID ( ReleaseDC( oSig:hWnd, hDC ), .T. )

return nil

static function DoDraw( hDc, x, y, lPaint )

   if ! lPaint
      MoveTo( hDC, x, y )
   else
      LineTo( hDc, x, y )
   endIf

return nil




here run ok
perkaps you must change the size of oSay
Last edited by Silvio.Falconi on Fri Oct 31, 2014 5:36 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6716
Joined: Thu Oct 18, 2012 7:17 pm

Re: Capture signature with Pad or Touchscreen

Postby Gale FORd » Fri Oct 31, 2014 5:36 pm

I agree there is a sample with Fivewin. But like I said in my post it does not work well with Pad/Pen or Touchscreen. It is barely usable with a mouse but with touchscreen or pen it does not work very well at all.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Capture signature with Pad or Touchscreen

Postby Gale FORd » Mon Nov 03, 2014 4:10 pm

I have it so that it works using your finger to sign but the pen still has problems. I need to know when the pen actually touches the screen and not just hovers above it. When it is hovering above the screen (not touching) and you move the pen the mouse cursor moves with it so it triggers the line drawing.
It may work with the fatter stylus/pens but I am using the fine point pen that comes with Surface 3.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Solved: Capture signature with Pad or Touchscreen

Postby Gale FORd » Mon Nov 03, 2014 6:15 pm

This is the modified sample that seems to work pretty well. With mouse, hold the button down while you sign. With pen it inks when the tip is on the glass.
Code: Select all  Expand view

#include "FiveWin.ch"

function CaptureSignature()

   local oDlg, oSig, lPaint := .f., cFile := Lower( "signature.bmp" ), hDC

   DEFINE DIALOG oDlg TITLE "Signature" FROM 0, 0 TO 150, 350 PIXEL

   @ 15, 5 SAY oSig PROMPT "" SIZE 150, 40 PIXEL BORDER OF oDlg

   @ 01, 5 BUTTON "Clear" SIZE 25, 10 PIXEL ACTION oSig:refresh(.t.) OF oDlg

   @ 01, 60 BUTTON "Save" SIZE 25, 10 PIXEL OF odlg ;
      ACTION ( oSig:SaveToBmp( cFile ), oDlg:End() )

   oSig:lWantClick := .T.
   oSig:bLButtonUp := { | x, y, z | DoDraw( hDC, y, x, lPaint := .F. ) }
   oSig:bMMoved    := { | x, y, z | DoDraw( hDC, y, x , lPaint ) }
   oSig:bLClicked  := { | x, y, z | DoDraw( hDC, y, x, lPaint := .T., .t.  ) }

   ACTIVATE DIALOG oDlg CENTER ;
      ON INIT ( hDC := GetDC( oSig:hWnd ) ) ;
      VALID ( ReleaseDC( oSig:hWnd, hDC ), .T. )

return nil

static function DoDraw( hDc, x, y, lPaint, lReset )
   if lReset != nil .and. lReset
      MoveTo( hDC, x, y )
   endif
   if ! lPaint
      MoveTo( hDC, x, y )
   else
      LineTo( hDc, x, y )
   endIf
return nil

 
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Capture signature with Pad or Touchscreen

Postby Antonio Linares » Tue Nov 04, 2014 10:06 pm

Gale,

many thanks! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41205
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 5 guests