xsharp.eu • ReportPro3 Printer Copies
Page 1 of 1

ReportPro3 Printer Copies

Posted: Sun May 09, 2021 11:23 am
by HeikoP
Hello world,

i just fixed another one. I am sooo happy that I bought a source code license. I should have done this much earlier.

Because nobody answerd to my other fixes, it seems to me, that i´m the onlyone still using ReportPro3 or all others have fixed these bugs themselves, because they have baught the sourcode much much earlier.

Anyway, i want to share what I found out with the world :-) This time the problem seemed to be in the Classmate Printer-Config-Dialog, which the ReportPro3-Designer is using. I just inserted three lines.

Greetings Heiko


METHOD ShowSetupDlg() AS LOGIC PASCAL CLASS cPrinter
/*
This method displays the Printer Setup Dialog that displays the current printer configuration and provides options for setting the paper orientation, size, and source.

PARAMETERS:
None.

RETURN VALUES:
This method returns TRUE if the user exited the dialog by clicking the OK button; FALSE if the CANCEL button is clicked.

REMARKS:
If the user makes changes in the dialog and presses the OK button, the changes are automatically saved in the internal structures of the cPrinter object.

*/

LOCAL oDlg AS cPrintSetupDialog
LOCAL sDN AS _WINDEVNAMES
LOCAL sDM1 AS _WINDEVMODE
LOCAL sDM2 IS _WINDEVMODE

~"ONLYEARLY+"

// CM 203 reset the cached sizes the paper dimensions will recalculate properly
SELF:nPaperLength :=0
SELF:nPaperWidth :=0

oDlg:=cPrintSetUpDialog{SELF:WindowOwner,SELF:sPD}
IF oDlg:Show(SW_NORMAL) // if everything went OK...bail out
SELF:_GetPrinterResolution()
* HJP 20210509 The next line stores the amount of copies in the actual printer configuration. Seems that this isn´t neccesary with windows xp and earlier.
self:Copies:=self:sPD.nCopies
RETURN true
ENDIF


// if DN's default flag doesn't match the setup
IF (SELF:nError:=oDlg:Error)==PDERR_DEFAULTDIFFERENT

IF (sDN:=LockDevNames(SELF:sPD))==NULL_PTR
SELF:nError:=PE_CANT_LOCK_DEVICE_NAMES
RETURN FALSE
ENDIF
// reset the default flag
sDN.wDefault:=_AND(sDN.wDefault,_NOT(DN_DEFAULTPRN))

UnLockDevNames(SELF:sPD)

IF oDlg:Show(SW_NORMAL)
SELF:_GetPrinterResolution()
* HJP 20210509 The next line stores the amount of copies in the actual printer configuration. Seems that this isn´t neccesary with windows xp and earlier.
self:Copies:=self:sPD.nCopies

RETURN true
ENDIF

SELF:nError:=oDlg:Error
ENDIF

IF SELF:nError==PDERR_PRINTERNOTFOUND // if the current printer is not valid...
// get the current device mode structure
IF (sDM1:=LockDevMode(SELF:sPD))==NULL_PTR
SELF:nError:=PE_CANT_LOCK_DEVICE_MODE
RETURN FALSE
ENDIF
// save the device mode settings
MemCopy(@sDM2,sDM1,_SIZEOF(_WINDEVMODE))

UnLockDevMode(SELF:sPD) // unlock global memory

IF !SELF:SetPrinter2Default()
RETURN FALSE
ENDIF

IF (sDM1:=LockDevMode(SELF:sPD))==NULL_PTR
SELF:nError:=PE_CANT_LOCK_DEVICE_MODE
RETURN FALSE
ENDIF

SELF:_CopyCriticalDmMembers(@sDM2,sDM1) // copy the critical members between structures

UnLockDevMode(SELF:sPD)

IF oDlg:Show(SW_NORMAL)
SELF:_GetPrinterResolution()
* HJP 20210509 The next line stores the amount of copies in the actual printer configuration. Seems that this isn´t neccesary with windows xp and earlier.
self:Copies:=self:sPD.nCopies

RETURN true
ENDIF

SELF:nError:=oDlg:Error
ENDIF

RETURN FALSE

~"ONLYEARLY-"

ReportPro3 Printer Copies

Posted: Sun May 09, 2021 3:02 pm
by Chris
Hi Heiko,

Thanks a lot for sharing your finds and fixes!

Indeed I think not too many people use RP3, the vast majority is still using RP2, maybe because it is easier to use without the dependency to Classmate I assume. Or people were not very troubled by those specific bugs, as you know we VOers are anyway so used to working around myriads of bugs and problems in VO :). But of course thanks for posting your findings, I am sure they will be helpful to some, sooner or later!