Page 1 of 1

Error when trying to preview a report

Posted: Wed Jun 09, 2010 6:37 am
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

Re: Error when trying to preview a report

Posted: Thu Jun 10, 2010 1:07 am
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.

Re: Error when trying to preview a report

Posted: Thu Jun 10, 2010 2:41 pm
by jparada
Hi Roberto,

Thank you for answering and thanks for your explanation

Best Regards
Javier

Re: Error when trying to preview a report

Posted: Fri Jun 11, 2010 1:02 am
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

Re: Error when trying to preview a report

Posted: Fri Jun 11, 2010 1:52 am
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.

Re: Error when trying to preview a report

Posted: Fri Jun 11, 2010 2:33 am
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

Re: Error when trying to preview a report

Posted: Fri Jun 11, 2010 10:30 pm
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 :)