CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

JQMSignature SaveAsImage not consistent

by dfields » 18 Oct 2016 01:31

I have been trying to use JQMSignature, but am unable to get consistent results. I am trying to capture the signature as an image by following the demo. It works about 30% of the time. Most time it will not output any file at all.

1. If the file already exists, it is not overwritten. There are no options to override this behavior.

2. If any file is created, you cannot read it back into the application. I want to bring it into a BLOB field, but anytime I try to read the file I get an access violation because it could not find the file.

3. I would rather save to a stream and skip the file entirely, but I cannot see any methods for that. Am I missing something?
dfields
 
Posts: 130
Joined: 24 Jul 2013 20:14

by zsleo » 18 Oct 2016 17:29

I also stuggled with this for too long...

http://www.cgdevtools.com/cgforum/viewtopic.php?f=67&t=3066

I agree that a streamed methods would be great to have along with database interface.

That said, the only way I could get saving and loading images to work correctly was to redesign my app to generate a new uniquely named image for every use of an image.

Thanks to Alexander "CGGenAutoID" has become my new best friend.

Hope this helps
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by dfields » 18 Oct 2016 21:29

I could not tell from the post you referenced. Did you ever get it to work?
dfields
 
Posts: 130
Joined: 24 Jul 2013 20:14

by Alexander Bulei » 19 Oct 2016 16:47

Hi dfields,

You can handle the saving by your self, by using :
  • OnSaveToStream - This event will be called when the image is sucessfully sent to server, when calling SaveAsImage
  • OnFileSaved - This event will be called when the image is sucessfully saved, when calling SaveAsImage

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by zsleo » 19 Oct 2016 19:43

Sorry for not being clear. Yes. I have it working perfectly for my use - and fully interfaced to MS SQL.

As for the link look at my post under the image component but I had the problem with both image and signature. Both now working for me.

Finally. Alexander, thanks for your help but I do wis these for these two components to be working by direct interface to DB without manipulating though streams or files. That stated I am very happy with what I now have working.
:D
Regards.
zsleo
 
Posts: 776
Joined: 03 Feb 2013 03:33

by dfields » 19 Oct 2016 23:13

So where do I use that method? Here is what I tried without success (below). I never get to DoOnSaveToStream. Are there other properties to set?

Code: Select all
//this happens in a button event
Signature1.OnSaveToStream := DoOnSaveToStream;
Signature1.SaveAsImage(fn);

procedure TFormSmartphoneSignature.DoOnSaveToStream(Sender: TObject; const AFileName: string; AStream: TStream);
begin
  with UserSession do
  begin
    ProxyData.Edit;
    TBLOBField(ProxyData.FieldByName('MemberSignature')).LoadFromStream(AStream);
    ProxyData.Post;
  end;
end;
dfields
 
Posts: 130
Joined: 24 Jul 2013 20:14

by Alexander Bulei » 21 Oct 2016 11:48

Hi dfields,

//this happens in a button event
Signature1.OnSaveToStream := DoOnSaveToStream;
Signature1.SaveAsImage(fn);


Code: Select all
Signature1.OnSaveToStream := DoOnSaveToStream;


Do nothing in async...
Assign the event on form/frame create...

Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal

by dfields » 21 Oct 2016 22:43

I tried that first, but it still does not work. Either way the breakpoint I set in that procedure is never reached. Now, I cannot get it to save a file at all. What am I missing?! This seems like such a simple task. Can you point me to a working example, or even post some complete code that I can follow?
dfields
 
Posts: 130
Joined: 24 Jul 2013 20:14

by Alexander Bulei » 24 Oct 2016 14:39

Hi dfields,

delphi code
procedure TIWAppForm6.IWAppFormCreate(Sender: TObject);
begin
IWCGJQMSignature1.OnSaveToStream:= OnSaveImage;
end;

procedure TIWAppForm6.IWCGJQMButton1JQMButtonOptionsEventsVClick(Sender: TObject; AParams: TStringList);
begin
IWCGJQMSignature1.SaveAsImage('test.png');
end;

procedure TIWAppForm6.OnSaveImage(Sender: TObject; const AFileName: string; AStream: TStream);
begin
sleep(0); // PUT BREAKPOINT HERE
end;


Best Regards.
Group: Developers | Support Team

  • info [at] cgdevtools.com - General information
  • sales [at] cgdevtools.com - Sales department
  • support [at] cgdevtools.com - Product and Technical Support
User avatar
Alexander Bulei
Site Admin
 
Posts: 3635
Joined: 15 May 2012 08:52
Location: Mealhada, Portugal


Return to JQMSignature

cron

Who is online

Users browsing this forum: No registered users and 0 guests

Contact Us.