Print Preview in MDI environment

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Print Preview in MDI environment

Post by nageswaragunupudi »

While rpreview is working well normally, when used in MDI environment, it is showing distorted view of the output. Here is a sample program. When I compile the main window as SDI preview works well. But when I complile the main window as MDI window, though the preview window appears nicely as an mdi child, the output is totally distorted. Is this happening to me only?

Can any one kindly help me out? All my major software is in MDI environment.

I am using FWH 7.09 with BCC xHarbour binaries provided by FiveWin.

Code: Select all

#include "FiveWin.ch"

#define MDIWIN

FUNCTION Main()

   LOCAL oWnd,oBar

#ifdef MDIWIN
   DEFINE WINDOW oWnd MDI TITLE "PREVIEW MDI WINDOW"
#else
   DEFINE WINDOW oWnd TITLE "PREVIEW SDI WINDOW"
#endif
   DEFINE BUTTONBAR oBar OF oWnd
   DEFINE BUTTON OF oBar PROMPT '1' ACTION PrintPV0()

   ACTIVATE WINDOW oWnd

RETURN NIL

STATIC FUNCTION PrintPV0()

   LOCAL oPrn, oFont

   PRINT oPrn PREVIEW
      DEFINE FONT oFont NAME 'ARIAL' SIZE 0,-10 OF oPrn
      PAGE
         oPrn:Say( 100, 100, "Test" , oFont )
         oPrn:Say( 150, 100, "SECOND LINE" , oFont )

      ENDPAGE
   ENDPRINT
   oFont:End()

RETURN NIL
Regards
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

NageswaraRao,

Comment out this line in source\classes\rpreview.prg line 1261:

Code: Select all

   if ! ::lZoom .and. ! lInit
      // ::Zoom( .T. )    A.L. 08 Oct 2007
   endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Thanks Mr. Antonio for your immediate reply. Yes, after commenting out ::Zoom(.T.), this problem is solved. But in the source code I have it is not line 1261 but it is line 1255. Is it possible the this program was modified after I downloaded my FWH ? Do you advise me to download FWH again? Or can I have the latest RPreview.Prg ?

I have a few other problems occassionally popping up. Like error while closing or starting preview with the message that Nil has no hWnd in metaplay method.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Don't worry about the source code line, ours is modified for version FWH 7.10 that will be published this same week probably.

>
I have a few other problems occassionally popping up. Like error while closing or starting preview with the message that Nil has no hWnd in metaplay method.
>

Are those errors coming from your PRG or from rpreview.prg ? It looks as oWnd is tried to be used as a valid window when its nil already
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Mr Antonio

I am getting this error from RPreview.Prg only. The error occurs in line " if IsIconic( ::oWnd:hWnd )" of PaintMeta method ( called from "on resize ::paintmeta() ). I am getting this error _occassionally_ when i click on the close button of the preview. Because I am getting it occassionally, I could not make a small self contained example. If I get it again and if i can create a small sample, I shall report it.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Mr Antonio.

Here is a program, slightly modified from a source provided by you earlier. Ths program creates 3 mdi child preview windows. Try to close the third preview window, we get this error. I dont know if I am doing something wrong. Kindly review and advise.

Code: Select all

#include "FiveWin.ch"

function Main()

   LOCAL oWnd,obar

   DEFINE WINDOW oWnd MDI TITLE "preview errors"

   DEFINE BUTTONBAR oBar OF oWnd
   DEFINE BUTTON OF oBar PROMPT '2' ACTION PrintPV()

   ACTIVATE WINDOW oWnd

return nil


function printpv
local oprn1,oprn2,oprn3

local ofont, oArial


PRINT oPrn1 PREVIEW

   DEFINE FONT oArial NAME 'ARIAL' SIZE 0,-11 OF oPrn1

   PAGE
      oPrn1:Say( 20, 20, "Test", oArial )
   ENDPAGE
ENDPRINT

MsgInfo( "one" )

PRINT oPrn2 PREVIEW
   DEFINE FONT oFont NAME 'TAHOMA' SIZE 0,-9 OF oPrn2
   PAGE
      oPrn2:Say( 4, 4, "Test", oFont )
   ENDPAGE
ENDPRINT

MsgInfo( "two" )

PRINT oPrn3 PREVIEW
   PAGE
      oPrn3:Say( 6, 6, "Test" )
   ENDPAGE
ENDPRINT

MsgInfo( "three" )

oFont:End()
oArial:End()

return nil
Regards
Nageswara Rao
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Please make this little change into source\rpreview.prg. This change is already included in FWH 7.10:

Code: Select all

   if ::oWnd != nil .and. IsIconic( ::oWnd:hWnd )
      return nil
   endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Post by nageswaragunupudi »

Thanks. Done. But this does not solve the problem fully. When ::oWnd is NIL, the execution goes to subsequent statements and fails at ::oWnd:nWidth.

I tried making this change instead:

Code: Select all

if ::oWnd == NIL .OR. isIconic( oWnd:hWnd )
  RETURN NIL
endif
Thisi s avoiding the errors. But I do not know what could be the other implications. Please advise.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Its fixed and tested in FWH 7.10.

You may be able to download it in just some minutes :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
norberto
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Post by norberto »

Antonio, my appl have this errors too, in workstations using windows nt 4 ocour. how to solve this? thanks
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Norberto,

We provide you a free upgrade for rpreview.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
norberto
Posts: 566
Joined: Thu Aug 30, 2007 3:40 pm
Location: BR

Post by norberto »

thanks, best regards.
Post Reply