EID identity card and a signature pad are totally different animals. The question itself is puzzling to me. I think signature pads are universal. Every country I've been to implements some sort of signature pad as part of commerce. For example, when you pay with a visa card at a restaurant and the they make you sign on an electronic screen that displays messages, a signing line, and perhaps an accept button. That type of device is what I mean by "signature pad".
I have had great success using Topaz line of signature pads. The code I share here allows you to display a message on the pad's screen, draws a couple of buttons to cancel and to accept and a line where the customer signs. Once the customer clicks on the accept button the signature is returned to my FW app as a jpg that then gets saved to a blob field. The code is very old and it is my actual code in production. It is not a sample app but rather the class itself in production for many years. I hope it helps. If anyone enhances the class, please publish it or send it to me so that I may also benefit from your work.
Code: Select all
#INCLUDE "patients.ch"
#INCLUDE "rgroup.ch"
//---------------------------------------------------------------------------------------
CLASS TTopazSignature
DATA bSave INIT { || .T. }
DATA bCleanUp, bDrawScreenPad
DATA bEventManager
DATA SigPlus1
DATA oImage
DATA oDlg, oBtn, oOwner
METHOD New( oOwner )
METHOD PickupSignature()
METHOD End()
END CLASS
//---------------------------------------------------------------------------------------
METHOD New( oOwner ) CLASS TTopazSignature
LOCAL oOkBMP, oClearBMP, oSignBMP
::oOwner := oOwner
TRY
::SigPlus1 := TActiveX():New( ::oOwner, "SIGPLUS.SigPlusCtrl.1", 0, 0, 0, 0 )
CATCH
MsgStop( "Topaz signature device could not be activated" )
RETURN NIL
END
IF !::SigPlus1:TabletConnectQuery()
MsgStop( "TOPAZ signature pad is not found or missing required components." )
RETURN NIL
ENDIF
::bCleanUp := { |o| ;
o:TabletState := 1,;
o:LCDRefresh( 0, 0, 0, 240, 64 ),; // 0 the display is cleared at the specified location
o:KeyPadClearHotSpotList(),;
o:LCDWriteFile( 1, 0, 0, 0, 240, 64, 0, "" ) ,; //CLEAR BACKGROUND MEMORY
o:SetSigWindow( 1, 0, 0, 240, 64 ),;
o:LCDSetWindow( 0, 0, 240, 64 ),;
o:LCDCaptureMode := 1,;
o:ClearTablet(),;
o:TabletState := 0 }
::bDrawScreenPad := < ||
::SigPlus1:LCDRefresh( 0, 0, 0, 240, 64 )
::SigPlus1:LCDCaptureMode := 2 //Sets mode so ink will not disappear after a few seconds
//Write BMP images out to the LCD 1X5 screen
oSignBMP := TImage():Define( "Pat_Sign_Line" ) //define a bmp for signature line a the bottom.
oClearBMP:= TImage():Define( "Pat_Sign_Clear" ) //define a bmp for clear signature button
oOkBMP := TImage():Define( "Pat_Sign_Ok" ) //define a bmp for accept signature button
//SigPlus1.LCDWriteBitmap( 1, 2, 0, 0, 240, 53, imgThankYou.Picture.Handle?? )
//LCDWriteBitmap used to write windows bitmap data to the lcd display.
::SigPlus1:LCDWriteBitmap( 0, 2, 0, 20, 240, 44, oSignBMP:hBitmap )
::SigPlus1:LCDWriteBitmap( 0, 2, 207, 4, 21, 11, oOkBMP:hBitmap )
::SigPlus1:LCDWriteBitmap( 0, 2, 15, 4, 38, 11, oClearBMP:hBitmap )
//Create the hot spot for the OK BMP
::SigPlus1:KeyPadAddHotSpot( 0, 1, 197, 5, 25, 17 ) //For OK button
::SigPlus1:KeyPadAddHotSpot( 1, 1, 10, 5, 53, 17 ) //For CLEAR button
::SigPlus1:TabletState := 1 //Turns tablet on to collect signature
//The following sets the LCD's signature window up to display ink only in the
//certain spot on the LCD specified--in this case, the Signature BMP area
::SigPlus1:LCDSetWindow( 0, 22, 240, 40 )
::SigPlus1:SetSigWindow( 1, 0, 22, 240, 40 ) //Sets the area where ink is permitted in the SigPlus object
oOkBMP:End() //distroy these bmp objects as they have already been sent
oClearBMP:End()//to the pad and we no longer need them in the pc's memory.
oSignBMP:End()
>
::bEventManager := < |cEvent, aParms |
LOCAL cFileName
IF ::SigPlus1:KeyPadQueryHotSpot( 0 ) > 0 .AND. ::SigPlus1:NumberOfTabletPoints > 0 //ok Botton has been clicked
cFileName := Temp_Name( "jpg" )
::SigPlus1:ImageFileFormat := 4 //compressed jpg
::SigPlus1:ImagePenWidth := 15
::SigPlus1:JustifyMode := 5
::SigPlus1:WriteImageFile( cFileName )
::oImage:LoadImage( ,cFileName )
::oImage:Refresh()
::odlg:Update()
fErase( cFileName )
::oBtn:Enable()
ELSEIF ::SigPlus1:KeyPadQueryHotSpot( 1 ) > 0 .AND. ::SigPlus1:NumberOfTabletPoints > 0 //CLEAR Botton
EVAL( ::bCleanUp, ::SigPlus1 )
EVAL( ::bDrawScreenPad )
::SigPlus1:SetEventEnableMask( 3 )
ELSE
//Sleep 5
::SigPlus1:ClearSigWindow( 1 )
::SigPlus1:SetEventEnableMask( 3 )
ENDIF
> //----------------------------------------------------------------------------------
RETURN SELF
//---------------------------------------------------------------------------------------
METHOD PickupSignature() CLASS TTopazSignature
LOCAL oDlg, bValid, bInit
::SigPlus1:LCDSetTabletMap( 0, 240, 64, 100, 0, 1900, 700 ) //Sets Map up for LCD 1X5 tablet
Eval( ::bCleanUp, ::SigPlus1 )
//******************************************************************'
// The following parameters are set in case the user's INI file is not correctly set up for an LCD 1X5 tablet
// Otherwise, if the INI is correctly set up, these parameters do not need to be set
::SigPlus1:TabletXStart := 400
::SigPlus1:TabletXStop := 2400
::SigPlus1:TabletYStart := 350
::SigPlus1:TabletYStop := 1050
::SigPlus1:TabletLogicalXSize := 2000
::SigPlus1:TabletLogicalYSize := 700
//******************************************************************'
EVAL( ::bDrawScreenPad )
// Enables Pen Up and Pend Down events 1 = Enables pen Down, 2 = Pen Up, 3 = both.
::SigPlus1:SetEventEnableMask(3)
::SigPlus1:bOnEvent := ::bEventManager
DEFINE DIALOG oDlg RESOURCE "Pat_Signature" TRANSPARENT COLOR CLR_BLUE, RGB( 240, 240, 240 ) OF ::oOwner
REDEFINE IMAGE ::oImage ID 1 OF oDlg ADJUST UPDATE
::oImage:lStretch := .T.
REDEFINE BUTTONBMP ::oBtn ID 200 OF oDlg BITMAP "Pen16" TEXTRIGHT ACTION ( EVAL( ::bSave, ::SigPlus1 ), oDlg:End() )
REDEFINE BUTTONBMP ID 201 OF oDlg BITMAP "Cancel16" TEXTRIGHT ACTION oDlg:End()
FONDOBOTONES 1001, oDlg
oDlg:lHelpIcon := .F.
bInit := {|| oDlg:Center( WndMain() ), ::oBtn:Disable() }
bValid := { || ClearTmpfiles(), IIF( ::oImage != NIL, ::oImage:End(), NIL ), .T. }
oDlg:oWnd := ::oOwner
::oDlg := oDlg
TRY
oDlg:Activate( ,,,,bValid, .T., bInit )
CATCH
END
Eval( ::bCleanUp, ::SigPlus1 )
::SigPlus1:TabletState := 0
RETURN NIL
//-----------------------------------------------------------------------------------
METHOD End() CLASS TTopazSignature
::SigPlus1 := NIL
::oImage := NIL
::oDlg := NIL
RETURN NIL
Reinaldo.