signatur.prg How can I know if the user has signed or not?

signatur.prg How can I know if the user has signed or not?

Postby MGA » Fri Nov 11, 2022 3:40 pm

How can I know if the user has signed or not?

Referring to this example, I need to force the user to sign. How can I test this?


#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
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: signatur.prg How can I know if the user has signed or not?

Postby Jimmy » Fri Nov 11, 2022 6:20 pm

hi,
MGA wrote:How can I know if the user has signed or not?

Sample \fwh\samples\signatur.prg "just" save a BMP but did not "recognize" it

have a look at \fwh\samples\msink.prg
when use MENUITEM "Text" you got a MsgInfo() but a GET would be better to present Result
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1586
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: signatur.prg How can I know if the user has signed or not?

Postby MGA » Fri Nov 11, 2022 7:41 pm

Jimmy:
I need to validate if the user signed the document.

referring to this example:
@ 15, 5 SAY oSig PROMPT "" SIZE 150, 40 PIXEL BORDER OF oDlg

Objeto:
oSig

i need something like this, example:

function Button_ValidSegnatur(oSig)
if Empty(oSig:cCaption)
MsgStop("It is mandatory to sign the document.")
return .f.
endif
return .t.
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: signatur.prg How can I know if the user has signed or not?

Postby Antonio Linares » Fri Nov 11, 2022 8:16 pm

Estimado MGA,

Solo tienes que consultar la variable lSigned para saber si ha firmado o no:
Code: Select all  Expand view
#include "FiveWin.ch"

function CaptureSignature()

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

   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 | lSigned := .T., 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
regards, saludos

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

Re: signatur.prg How can I know if the user has signed or not?

Postby MGA » Fri Nov 11, 2022 8:30 pm

Thanks :D
ubiratanmga@gmail.com

FWH18.02
FWPPC
Harbour/xHarbour
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1234
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Re: signatur.prg How can I know if the user has signed or not?

Postby Jimmy » Fri Nov 11, 2022 9:20 pm

hi,
MGA wrote:I need to validate if the user signed the document.

using your Sample i can "just" Paint 1 x Pixel as Signature and press "Save" ... :roll:

msink.prg use Microsoft INK when made a Signature
it can "recognize" if and what User have "write"

when got Result of "recognition" you can "test" if Signature was made or not
when have Name of Receiver you can compare if Signature is right Name

p.s. if you need to "Save" Signature as Image i do have some "more" CODE (but HMG or Xbase++ Syntax)
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1586
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 84 guests