HMG 3.0.40, print preview problem

Source code related resources

Moderator: Rathinagiri

Post Reply
majkll_ns
Posts: 7
Joined: Sun Oct 24, 2010 12:50 pm

HMG 3.0.40, print preview problem

Post by majkll_ns » Tue Mar 20, 2012 6:17 pm

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.

User avatar
salamandra
Posts: 128
Joined: Thu Jul 31, 2008 8:33 pm
Location: Brazil

Post by salamandra » Tue Mar 20, 2012 7:44 pm

:) 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
There is one time in which is crucial awakening. That time is now. ( Buddha )

majkll_ns
Posts: 7
Joined: Sun Oct 24, 2010 12:50 pm

Post by majkll_ns » Wed Mar 21, 2012 2:00 am

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 :)

User avatar
esgici
Posts: 4264
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Has thanked: 140 times
Been thanked: 54 times
Contact:

Post by esgici » Wed Mar 21, 2012 2:20 am

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
Viva INTERNATIONAL HMG :D

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest