Jump to content
Ian Branch

Capture a signature and store in DB

Recommended Posts

Hi Team,

D10.3.3, 32Bit Apps.

I have written a couple of native Windows Apps for a Company that is now making them available to their Customers via ThinFinity from Cybele Software.  https://www.cybelesoft.com/

Some of their Field Techs are now using it to log and complete tasks in the field via the browser on their Company iPads.

Everything works as designed, no issue.

What they, the Company, have now asked is if I can add the ability for their Customer to Sign the iPad against the Task signifying their acceptance that the Task is finished to their satisfaction.

The Company expects the Signature to be recorded against the database Task record.

Given the configuration..

Application running on a Win 2012 Server via Thinfinity and the Web to the browser on the iPad.

Is it even possible to capture the signature through this means?

I can certainly add a field in the database and Tasking interface to present a Memo field of some sort but I don't know that it is possible for the application to capture a signature via the iPad hardware/software.

Does anybody have any experience/thoughts along these lines?

 

Regards & TIA,

Ian

Edited by Sherlock
Changed Title

Share this post


Link to post

How sure do you have to be, that the signature is real? It is quite easy to let someone draw his signature in a TPaintbox, and then store the image as a BLOB in the DB. But if you need to make sure, this signature is real, then you would have to store the dynamics of its creation. That is tricky.

Share this post


Link to post

Thanks Sherlock.

Making sure the signature is real is not my concern.

Taking your cue, and having never used it, I did a quick search for using TPaintBox.

I found some references but nothing that would point me in the direction of writing into it with a mouse.

I did see one suggestion to use a TImage rather than TPaintBox but it wasn't particularly helpful 😞

I'd appreciate any hints/references to writing into a TPaintBox in an App with a mouse.

 

Regards & TIA,

Ian

Share this post


Link to post

Hi Ian,

I'm not sure if it helps as I don't know Thinfinity, but this is the unit I made for capturing signatures.

Just create the class with a TImage in the construcor parameter:

    imgSigno: TImage;
    ....
    FSigno := TSigno.Create(imgSigno);
    FSigno.OnChange := OnChangeSigno;

 

On the OnChange you can do some validation or GUI events like enabling a button OK.

You can set the FSigno.PenWidth to fine tune the signature quality.

On SaveAs* the image will be cropped to the actual signature to minimize the image size.

You can use it as you want if it works or helps. 

Signature.pas

  • Like 1

Share this post


Link to post

Hi Atilla,

Thank you very much.

Unfortunately my skills don't match yours. 😞

I have the following..

procedure TShowRecordForm.Button1Click(Sender: TObject);
var
  fSigNo:TSigNo;
begin
  fSigno := TSigno.Create(imgSigno);
  //fSigno.OnChange := OnChangeSigNo;
....
....

When I run the App and click the button I get an Access violation for the TSigNo.Create(imgSigNo) line. 😞

Signature is included in the uses and I have     imgSigno:TImage;  in the public area.

 

Ian

Share this post


Link to post

Just created a new app and works fine for me. You have to debug. 

Is it a VCL app? The TImage is on the Form not just declared somewhere?

Share this post


Link to post

Yes, it is a VCL App.  The TImage is on the form.

I just created a new app too.

unit Unit23;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TForm23 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    imgSigno:TImage;    
  end;

var
  Form23: TForm23;

implementation

uses
  Signature;

{$R *.dfm}

procedure TForm23.Button1Click(Sender: TObject);
var
  fSigNo:TSigNo;
begin
  fSigno := TSigno.Create(imgSigno);
  //fSigno.OnChange := OnChangeSigNo;

end;

end.

Same error

image.thumb.png.81ada852ffbe171058cde9d109a29846.png

on the Create. 😞

 

Ian

 

 

Share this post


Link to post

You should forget imgSigno and pass "Image1" in the Create().

imgSigno is not instantiated, its just declared. Delete it.

fSigno := TSigno.Create(Image1);
Edited by Attila Kovacs

Share this post


Link to post

Ah Ha!  Bingo!

Thank you very much.

image.png.3211c85dcccaa78b78ba8e919cdd21b0.png

If I enable   fSigno.OnChange := OnChangeSigNo;  I get an undeclared identifier when building.

It doesn't know about OnChangeSigNo.

 

I also deleted the imgSigno:TImage; declaration.

 

Ian

 

Share this post


Link to post

You have to declare OnChangeSigNo first, but from now you have to do some work too 😉

OnChangeSigNo  = TNotifyEvent which means you add a procedure to your form like:

 

procedure TForm1.OnChangeSigNo (Sender: TObject);
begin
end;

 

Please let me know if it works over Thinfinity. 

 

@Sherlock could you rename the topic that others can find it too?

 

Edited by Attila Kovacs

Share this post


Link to post

Atilla,

This is via Thinfinity.

image.thumb.png.b2768893332441691c20ffb46eaca032.png

Haven't sussed out the saving yet but at least I can write.

It doesn't work on my iPad though. 😞  Probably needs the stylus.

Ian

Share this post


Link to post

Thx Ian. I'm afraid it's rather the lack of a touchmanager in VCL. At least I could not find any info how to fire it up, if it even possible.

Maybe somebody has an idea.

Share this post


Link to post

Atilla,

On the iPad, I did find that when I clicked the button and moved the mouse/pointer down to the TImage, the first press of the screen left a dot but wouldn't track.

It is a relatively old 9.7" iPad, don't know if that has any bearing.  Might see if I can find someone with an iPad stylus to try.

Thanks for all your help.

Regards,

Ian

Share this post


Link to post
8 hours ago, Sherlock said:

How sure do you have to be, that the signature is real?

Have you received UPS/DHL packages recently ?

Make a test, how important the signature nowadays is ...

I could even make 3 crosses, and nobody complains.

  • Haha 2

Share this post


Link to post

Hi Team,

Update - I received and tested on an Android tablet today.  Same outcome as the iPad.

 

Ian

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×