Bug in TVPEngine.SetupPrinter()

Knowledge exchange related to the VPE Report Engine and PDF Library

Moderator: IDEAL Software Support

Bug in TVPEngine.SetupPrinter()

Postby IDEAL Software Support » Tue Nov 23, 2004 3:49 pm

Hello,

in the procedure TVPEngine.SetupPrinter() is a Function-call to the
function VpeSetupPrinter().
This function returns a value depending on pressing 'OK' or 'Cancel'
in the Setup-Dialog.

But this function-result is not delivered to the calling routine
TVPEngine.SetupPrinter(), thus there is no possibility to check if
the user pressed 'OK' or 'Cancel'.

In my case, the program starts to print, no matter the user
pressed 'OK' or 'Cancel'!
So, is there a way for a workaround where I don't have to change the
VPE_VCL unit?


Sorry for my bad english - i usually speak german...

Thanx for any fast response!!
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Postby IDEAL Software Support » Tue Nov 23, 2004 3:49 pm

What version of VPE are you using? We checked our source code tree down to version v3.0 (released in March 1999) and the Delphi VCL method TVPEngine.SetupPrinter() returns correctly the result.

If you are using an older version, you can of course patch the source code for the Delphi VCL yourself.

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Postby IDEAL Software Support » Tue Nov 23, 2004 3:50 pm

I use Version 3.1

Here the codepart that seems buggy to me:
(obviously a VPE_VCL-Procedure is calling the VpeSetupPrinter()-
Function and therefore cannot return the function-result)

procedure TVPEngine.SetupPrinter
(filename:String;dialog_control:Integer);
{$IFNDEF WIN32} var p:PChar; {$ENDIF}
begin
if iVpeOpen then
begin
if filename<>'' then
begin
{$IFNDEF WIN32}
p:=StrAlloc(length(filename)+1);
StrPCopy(p,filename);
VpeSetupPrinter(hDoc, p, dialog_control);
StrDispose(p);
{$ELSE}
VpeSetupPrinter(hDoc, PChar(filename), dialog_control);
{$ENDIF}
end else begin
VpeSetupPrinter(hDoc,nil,dialog_control);
end;
end else begin
ErrDocNotOpen('SetupPrinter');
end;
end;
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Postby IDEAL Software Support » Tue Nov 23, 2004 3:50 pm

The source code in your e-mail is definitely older. We checked the *whole* source code tree and the last time this source code was used was in VPE v2.40, which was a free supplement to the BasicPro magazine back in 1999.

The correct code (used since VPE v3.0 in 1999) is:

function TVPEngine.SetupPrinter
(filename:String;dialog_control:Integer):Integer;
{$IFNDEF WIN32} var p:PChar; {$ENDIF}
begin
if iVpeOpen then
begin
if filename<>'' then
begin
{$IFNDEF WIN32}
p:=StrAlloc(length(filename)+1);
StrPCopy(p,filename);
result:=VpeSetupPrinter(hDoc, p, dialog_control);
StrDispose(p);
{$ELSE}
result:=VpeSetupPrinter(hDoc, PChar(filename), dialog_control);
{$ENDIF}
end else begin
result:=VpeSetupPrinter(hDoc,nil,dialog_control);
end;
end else begin
ErrDocNotOpen('SetupPrinter');
end;
end;

Regards
Thorsten Radde
IDEAL Software GmbH
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm

Postby IDEAL Software Support » Tue Nov 23, 2004 3:50 pm

I must apologize.

You are correct.
We bought the 3.1 prof version from you, but something in the
renderengine or anything else didn't fit in our Reports, so we
decided to use an older version that was working right for us.

So, everything becomes clearer for me, now.

Thank you for your efforts.
IDEAL Software Support
 
Posts: 1621
Joined: Thu Nov 18, 2004 4:03 pm


Return to VPE Open Forum

Who is online

Users browsing this forum: No registered users and 50 guests