Error when trying to preview a report

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

Error when trying to preview a report

Post by jparada »

Hi,

I'm getting the error that I show in the picture attached, please take a look.

Also attached a small example (based on HMG examples).

If you put as a comment line 16 (BUTTON btnAcepta...), the example generates the error as attached image.

And if you put as a comment line 17 - printTest1 () and uncomment line 16, then the example works fine.

The question is why?, and if I'm doing something wrong.

And if someone asks me,

What I need is to use the property NOSHOW in the definition of the window, why?, Because in a console mode application with HMG, I need to generate reports and preview (preview in graphical mode) and print.

Then in the console mode application (in the print option - application menu) should be to deploy and/or print the report generated.

BTW, All this that I need to do, it will be possible?, someone has tried?.

I appreciate any help.

Thanks

Best Regards
Javier
Attachments
img_print.png
img_print.png (20.35 KiB) Viewed 3071 times
imprimir.zip
(694 Bytes) Downloaded 222 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: Error when trying to preview a report

Post by Roberto Lopez »

jparada wrote:Hi,

I'm getting the error that I show in the picture attached, please take a look.

Also attached a small example (based on HMG examples).

If you put as a comment line 16 (BUTTON btnAcepta...), the example generates the error as attached image.

And if you put as a comment line 17 - printTest1 () and uncomment line 16, then the example works fine.

The question is why?, and if I'm doing something wrong.

And if someone asks me,

What I need is to use the property NOSHOW in the definition of the window, why?, Because in a console mode application with HMG, I need to generate reports and preview (preview in graphical mode) and print.

Then in the console mode application (in the print option - application menu) should be to deploy and/or print the report generated.

BTW, All this that I need to do, it will be possible?, someone has tried?.

I appreciate any help.

Thanks

Best Regards
Javier
The problem is that you are starting a print preview before activating/ closing the main window definition.

So, print preview attempt to define (and activate) its own window 'inside' a not closed define window... end window structure, giving you an error message.

This behavior is by design.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

Re: Error when trying to preview a report

Post by jparada »

Hi Roberto,

Thank you for answering and thanks for your explanation

Best Regards
Javier
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

Re: Error when trying to preview a report

Post by jparada »

Hi Roberto,

I think I found the solution (very simple indeed)

Please take a look at small change in the code:

Code: Select all

DEFINE WINDOW Win_1 ;
	AT 0,0 ;
	WIDTH 400 ;
	HEIGHT 400 ;
	TITLE 'MiniPrint Library Test' ;
	WINDOWTYPE MAIN ;
	ONINIT PrintTest1() ;
	NOSHOW
And in the application (HMG console), I do this:

Code: Select all

EXECUTE FILE "c:\testhmg\imprimir.exe"
and that's all.

Now the question is, can there be any problems doing something like what I'm doing, I mean, I do not know, incompatibility or something "bad."

Thanks

Best Regards
Javier
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: Error when trying to preview a report

Post by Roberto Lopez »

jparada wrote:Hi Roberto,

I think I found the solution (very simple indeed)

Please take a look at small change in the code:

Code: Select all

DEFINE WINDOW Win_1 ;
	AT 0,0 ;
	WIDTH 400 ;
	HEIGHT 400 ;
	TITLE 'MiniPrint Library Test' ;
	WINDOWTYPE MAIN ;
	ONINIT PrintTest1() ;
	NOSHOW
And in the application (HMG console), I do this:

Code: Select all

EXECUTE FILE "c:\testhmg\imprimir.exe"
and that's all.

Now the question is, can there be any problems doing something like what I'm doing, I mean, I do not know, incompatibility or something "bad."

Thanks

Best Regards
Javier
I should look at the whole thing to give you a proper answer, but, based on small chunks of code that you've posted, it appears to be ok.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
jparada
Posts: 433
Joined: Fri Jan 23, 2009 5:18 pm

Re: Error when trying to preview a report

Post by jparada »

Hi Roberto,

Thanks for answering.
Roberto Lopez wrote:I should look at the whole thing to give you a proper answer, but, based on small chunks of code that you've posted, it appears to be ok.
Here you have a small example, please take a look.

I await your comments please.

Thanks

Best Regards
Javier
Attachments
test.zip
(1.09 KiB) Downloaded 265 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4012
Joined: Wed Jul 30, 2008 6:43 pm

Re: Error when trying to preview a report

Post by Roberto Lopez »

jparada wrote:Hi Roberto,

Thanks for answering.
Roberto Lopez wrote:I should look at the whole thing to give you a proper answer, but, based on small chunks of code that you've posted, it appears to be ok.
Here you have a small example, please take a look.

I await your comments please.

Thanks

Best Regards
Javier
You've done a very strange construct indeed.

You are stopping main window activation process with the print preview windows activation message loop and then releasing it.

OnInit event is not intended to be used in such way and I couldn't encourage anybody to do it so, but I guess that you'll be ok anyway :)
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply