Page 1 of 1

HMG 3.0.40, print preview problem

Posted: Tue Mar 20, 2012 6:17 pm
by majkll_ns
I have problem using

SELECT PRINTER DIALOG TO print_ok PREVIEW

which gives:
........
Error BASE/2022 Argument error: ALLTRIM
Called from ALLTRIM(0)
Called from STRZERO(743)
......

I use and propose this solution:

in HMG\SOURCE\h_controlmisc.prg add

*-----------------------------------------------------------------------------*
*
* Mkl to avoid error in printer previewrefresh
* replace strzero with this
* also replace in include\i_print.ch
*-----------------------------------------------------------------------------*
Function sstrzero ( m_num, m_len )
*-----------------------------------------------------------------------------*
private m_s, m_v
m_v:=m_num
if type('m_v')<>'N'
m_num:=0
endif
m_s:=replicate('0',m_len)+alltrim(str(m_num))
m_s:=right(m_s,m_len)
return m_s

and replace all strzero with sstrzero in HMG\SOURCE\h_controlmisc.prg and HMG\INCLUDE\i_print.ch.

Then, create obj directory under HMG and use Makehmg.bat from HMG\SOURCE

You should have new libhmg.a in HMG\Lib

After this all compiled program work fine.

Re: HMG 3.0.40, print preview problem

Posted: Tue Mar 20, 2012 7:44 pm
by salamandra
:) Hi majkll_ns ,
I use HMG 3.0.40 and work fine for me ;)
SELECT PRINTER DIALOG TO print_ok PREVIEW
Be sure that "print_ok" it´s a logical value...


[]´s Salamandra

Re: HMG 3.0.40, print preview problem

Posted: Wed Mar 21, 2012 2:00 am
by majkll_ns
salamandra wrote::) Hi majkll_ns ,
I use HMG 3.0.40 and work fine for me ;)
SELECT PRINTER DIALOG TO print_ok PREVIEW
Be sure that "print_ok" it´s a logical value...

[]´s Salamandra
I try that in a first place, but no result.
print_ok (lsuccess in demos) don't have to be defined. Command create it. To be sure I put print_ok:=.t. before it.
I locate problem in strzero(). If parameter given to strzero isn't defined or is a wrong type - it generates error. If I see it good, there are two things which can cause problem: seconds() and logic to deal with printing odd and even pages. I couldn't resolve it, so I change it in a described way.
And yes, and this take me great amount of time, same code which generate problem I put in separate program, just with part for generating one page and - it work just fine! And error in application. My solution can be marked as workaround. What is real cause I don't know.
If one ever face this as I do - try proposed solution :)

Re: HMG 3.0.40, print preview problem

Posted: Wed Mar 21, 2012 2:20 am
by esgici
Hi

The <hmg>\SAMPLES\PRINT\filledrectangle\demo.prg has a function that achieve this task with no problem :

Code: Select all

Procedure PrintTest4()
*------------------------------------------------------------------------------*
Local i 
Local lSuccess

	SELECT PRINTER DIALOG TO lSuccess PREVIEW

	If lSuccess == .T.
		PrintDoc()
		MsgInfo('Print Finished')
	EndIf

Return
*------------------------------------------------------------------------------*
If you give your code segment that cause the problem we will work on it.

Regards

--

Esgici