ActiveX problem

ActiveX problem

Postby reinaldocrespo » Sun Jan 11, 2009 12:25 am

Hi everyone;

I'm trying to use an ActiveX that works with a signing pad hardware. It contains a method to display a standard dialog to pickup a signature. When executed it looks like this:

Image

After clicking [OK] the application aborts without showing any type of message. Clicking on [Clear] or [Cancel] work as expected. The error can't be trapped with TRY-CATCH-END. All other properties and methods seem to work just fine.

Here is part of the code:
Code: Select all  Expand view
//------------------------------------------------------------------------//

METHOD New( ) CLASS TePad
local lOk   := .t.
local oErr

   
   DEFINE WINDOW ::oWnd FROM -300, -300 TO -300, -300   //hidden

TRY
   ::oActiveX := TActiveX():New( ::oWnd, "esW25COM.esCapture.1" )
   ::cDevice := ::oActiveX:GetProp( "ConnectedDevice" )

/*----------------------------------------------------------------------------
ConnectedDevice =
{98C174D3-6D2A-4509-96DB-D5B34FA7A561}: Interlink ePadInk
{7FCD9512-8763-436E-8747-40972EE28EFD}: Interlink ePad
{C55C5D54-8A92-48AD-A32F-1FC58092A581}: Interlink ePadID
------------------------------------------------------------------------------*/

CATCH oErr
   ::end()
   Return Nil

END
   
RETURN Self

//------------------------------------------------------------------------//
METHOD SetProp() CLASS TePad

   ::oActiveX:SetProp( "SignDlgCaption", ::cCaption )
   ::oActiveX:SetProp( "DisplayName", ::cDispName )
   ::oActiveX:SetProp( "ShowSignerName", 1 )   //true
   ::oActiveX:SetProp( "EnableAntiAliasing", 1 )

RETURN NIL

//------------------------------------------------------------------------//
METHOD PickUpSignature() CLASS TePad
local nRet

TRY
   nRet := ::oActiveX:Do( "StartSign" , 0, 1 )
CATCH
   logfile( "trace.log", {"catched with errors"})
END

Logfile( "trace.log", { "Just testing", ::cDevice } )

Return nRet



To execute I simply do this:
Code: Select all  Expand view
Static Function Test()
Local oSign := TePad():New()

   if oSign <> nil
   
      oSign:cCaption := "Get Patient Signature Dialog"
      
      oSign:cDispName := ProperPatName( odbf ) + " Or Guardian"
      oSign:SetProp()
      
      oSign:PickUpSignature()
      oSign:End()
      
   endif



Any ideas how to debug this problem?


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Antonio Linares » Sun Jan 11, 2009 7:09 am

Reinaldo,

Please use oActiveX:bOnEvent to check what events you receive.

Please review FWH\samples\webexp.prg for an oActiveX:bOnEvent example of use.
regards, saludos

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

Re: ActiveX problem

Postby Otto » Sun Jan 11, 2009 8:11 am

Hello Reinaldo,
there is a very good solution in FWPPC forum in pure FIVEWIN. This should work with FWH too.
Regards,
Otto

function Signature()

local oMain, oSig, nHdc, ;
nOldX := -1, ;
nOldY := -1

LOCAL DFILE := CURDIR() + "\MYSIGN.BMP"

DEFINE WINDOW oMain TITLE "Signature"

@40,5 SAY oSig PROMPT "test"+CRLF+"test2"+CRLF+dtoc(date())+" - " +time() SIZE 230,150 PIXEL BORDER

@15, 5 BUTTON "Clear" SIZE 50,20 PIXEL ACTION oSig:refresh(.t.)
@15,60 BUTTON "Save" SIZE 50,20 PIXEL ACTION ( oSig:saveToBmp( DFIle ), oSig:refresh(.t.), ReleaseDC( oSig:hWnd, oSig:hDC ), OMAIN:END() )

nHdc := GetDC( oSig:hWnd )


oSig:bLButtonUp := { |x,y,z| DoDraw( nHdc, y+1, x+1,@noldx,@noldy ), nOldX := -1, nOldY := -1 }
oSig:bMMoved := { |x,y,z| DoDraw( nHdc, y, x ,@noldx,@noldy) }
oSig:bLClicked := { |x,y,z| DoDraw( nHdc, y, x ,@noldx,@noldy) }

ACTIVATE WINDOW oMain MODAL

return nil

//----------------------------------------------------------------------------//

STATIC Function DoDraw( hDc, x, y, noldx, noldy )

If nOldX == -1 .And. nOldY == -1
nOldX := x
nOldY := y
MoveTo( hDC, x, y )
Else
LineTo( hDc,x,y )
EndIf

RETURN Nil

//----------------------------------------------------------------------------//
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: ActiveX problem

Postby reinaldocrespo » Sun Jan 11, 2009 7:30 pm

Otto;

Thank you for your reply. I agree, that is an excellent example. However, not appropriate for a point of sale where you want to pick up a customer signature or a legal biding contract where you want the parties to sign some legal e-document.

The signature pad is used to pickup a customer signatures in stores and is widely used in the business world. You sign with a stylus which has a better feel than the mouse, and furthermore, the signing pad is on the other side of the desk easily available for the customer to sign. My intention is to store the signature in a blob field, so that it may be reproduced later.

Again, thank you for the reply; but I need to use a signing pad.

In case anyone is interested here is a link to some good signing pads that work with ocx controls:
http://www.interlinkelectronics.com/library/media/papers/pdf/epad-ink-datasheet-6-27.pdf


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Otto » Sun Jan 11, 2009 7:51 pm

Hello Reinaldo,

you are right. I didn't thought on hardware.
Thank you for the link.
Regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6330
Joined: Fri Oct 07, 2005 7:07 pm

Re: ActiveX problem

Postby reinaldocrespo » Sun Jan 11, 2009 8:04 pm

Antonio;

Did as per your suggestion. Here is my new code:
Code: Select all  Expand view
//------------------------------------------------------------------------//

METHOD New( oOwner, oProcess ) CLASS TePad
local lOk   := .t.
local oErr
local cEvents   := ""
   
   DEFINE WINDOW ::oWnd FROM -300, -300 TO -300, -300   //hidden

TRY
   ::oActiveX := TActiveX():New( ::oWnd, "esW25COM.esCapture.1" )
   ::cDevice := ::oActiveX:GetProp( "ConnectedDevice" )
   ::oWnd:oClient := ::oActiveX
   ::oActiveX:bOnEvent := { |e, a| cEvents += EventInfo( e, a ) }
CATCH oErr
   ::end()
   Return Nil
END

   ACTIVATE WINDOW ::oWnd
   
RETURN Self

//------------------------------------------------------------------------//
METHOD SetProp() CLASS TePad

   ::oActiveX:SetProp( "SignDlgCaption", ::cCaption )
   ::oActiveX:SetProp( "DisplayName", ::cDispName )
   ::oActiveX:SetProp( "ShowSignerName", 1 )   //true
   ::oActiveX:SetProp( "EnableAntiAliasing", 1 )

RETURN NIL

//------------------------------------------------------------------------//
METHOD PickUpSignature() CLASS TePad
local nRet

TRY
   ::oActiveX:Do( "StartSign" , 0, 1 )
CATCH
   logfile( "trace.log", {"catched with errors"})
END

Logfile( "trace.log", { "Just testing", ::cDevice } )

Return nRet

//------------------------------------------------------------------------//
static function EventInfo( e, a )
local cMsg    := "Event:" + cValToChar( e ) + CRLF
local n

   cMsg += "Parms:"
   for n:=1 to Len ( a )
      cMsg += cValToChar( a[n] ) + CRLF
   next n
   
return cMsg + CRLF


And here is the code that calls that code:
Code: Select all  Expand view
Local oSign := TePad():New()

   if oSign <> nil
   
      oSign:cCaption := "Get Patient Signature Dialog"
      
      oSign:cDispName := ProperPatName( odbf ) + " Or Guardian"
      oSign:SetProp()
      
      oSign:PickUpSignature()
      oSign:End()
      
   endif


The standard signing dialog pops up and everything works as expected until I press the [ok] button. At that moment the application aborts and no messages are displayed. Nothing gets logged into trace.log either.

Any other ideas?


Reinaldo
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby reinaldocrespo » Sun Jan 11, 2009 8:51 pm

Antonio;

I realized that I wasn't doing anything with bOnEvent, so I changed the line to this:
Code: Select all  Expand view
   ::oActiveX:bOnEvent := { |e, a| logfile( "trace.log", {EventInfo( e, a ) } ) }


The following information gets logged as soon as the signing begins:
01/11/2009 15:48:34: Event:OnFirstTouch
Parms:

But after pressing [ok] nothing gets logged and the application aborts.



Reinaldo
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Antonio Linares » Mon Jan 12, 2009 12:07 am

Reinaldo,

Are you sure that you have to use it as an ActiveX ?

Maybe you should create it using CreateObject() and manage it as an OLE object, not as an ActiveX.
regards, saludos

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

Re: ActiveX problem

Postby reinaldocrespo » Mon Jan 12, 2009 8:28 pm

Tried it. Same result. I only wish I could stop execution to see what's happening after the [ok] button on that dialog is doing. Here is my new code:
Code: Select all  Expand view
//------------------------------------------------------------------------//
METHOD New() CLASS TePad

TRY
   ::oActiveX := GETACTIVEOBJECT( "esW25COM.esCapture.1" )
CATCH
   TRY
      ::oActiveX := CREATEOBJECT( "esW25COM.esCapture.1" )
   CATCH
      Alert( "ERROR! SigningPad not avialable. [" + Ole2TxtError()+ "]" )
      ::end()
      Return Nil
   END
END

RETURN Self

//------------------------------------------------------------------------//
METHOD SetProp() CLASS TePad

   ::oActiveX:SignDlgCaption := ::cCaption
   
RETURN NIL

//------------------------------------------------------------------------//
METHOD PickUpSignature() CLASS TePad
local nRet

TRY
   ::oActiveX:ClearSign()
   ::oActiveX:StartSign( 0, 1 )
CATCH
   logfile( "trace.log", {"catched with errors"})
END

Logfile( "trace.log", { "Just testing", ::cDevice } )

Return nRet


The dialog hast three buttons. [Clear], [Cancel], [Ok]. Clicking on any of these and it all work as expected, except when clicking on [Ok] after signing. The app simply aborts.



Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Antonio Linares » Mon Jan 12, 2009 9:10 pm

Reinaldo,

Is ::oActiveX:StartSign( 0, 1 ) the method to invoke the signature dialogbox ?

What 0 and 1 mean ?
Do you have any example of use in VB, C, etc. or docs for it ?
regards, saludos

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

Re: ActiveX problem

Postby reinaldocrespo » Mon Jan 12, 2009 10:05 pm

Antonio;

Good idea. Here is a link to the documentation and the actual ocx and dll needed for testing:

http://ssfl.dynalias.com/temp

Download the .pdf and the .ocx and the .dll for your own tests. [I think] The only thing you won't be able to do without the pad is the actual signing, therefore you won't be able to test the ok button.

The ocx is usable for different models. The model I'm testing is the ePad id. That first parameter does nothing with the ePad Id. On a ePad Ink, it would control the number of buttons to display on the pad. Here is a link to their devices:

http://www.interlinkelectronics.com/esign/products/epad/index.html

Thank you for your help.


Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Antonio Linares » Tue Jan 13, 2009 12:14 am

Reinaldo,

What we need is that you locate some VB or C example code for it and post it here to review it, thanks
regards, saludos

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

Re: ActiveX problem

Postby reinaldocrespo » Tue Jan 13, 2009 12:20 am

Ok. Here is the whole vb project and also the .exe build of the sample code:
http://ssfl.dynalias.com/temp/epad_vb_sample

Reinaldo.
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Re: ActiveX problem

Postby Antonio Linares » Tue Jan 13, 2009 12:30 am

Reinaldo,

Is your PRG code similar to this one ?
Code: Select all  Expand view
Private Sub CmdStartSign_Click()
    SignData = vbNullString
    'set the sign dialog caption
    IntegriSign1.SignDlgCaption = "IntegriSign Signature Capture"
    'set the data to be associated with the signature
    IntegriSign1.HashData = txtHashData.Text
    'set whether cross mark needs to be displayed if content is modified
    If chkAppOptions(5).Value = 0 Then
        IntegriSign1.Cross = Cross_OFF
    Else
        IntegriSign1.Cross = Cross_ON
    End If
    'initiate the act of signing
    IntegriSign1.StartSign cmbBut.ListIndex, chkAppOptions(6).Value
    If chkAppOptions(6).Value = 1 Then
        lblft.Caption = vbNullString
    End If
End Sub
regards, saludos

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

Re: ActiveX problem

Postby reinaldocrespo » Tue Jan 13, 2009 12:50 am

Well... I'm skipping some of the optional statements. According to the documentation you don't have to set hash data if you don't need signature validation. I'm not setting the .cross property either, since I'm not doing the hashing anyway. So actually, my code is much simpler. I first create the Ole instance object, set the dialog caption, and proceed to StartSign().

So basically my code is:

Code: Select all  Expand view
   ::oActiveX := CREATEOBJECT( "esW25COM.esCapture.1" )
   ::oActiveX:SignDlgCaption := ::cCaption
   ::oActiveX:StartSign( 0, 1 )


For some reason it all works well in their sample apps. But pressing [ok] after taking the signature breaks my app. I'll continue to investigate.

Thank you,


Reinaldo
User avatar
reinaldocrespo
 
Posts: 979
Joined: Thu Nov 17, 2005 5:49 pm
Location: Fort Lauderdale, FL

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 92 guests