FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Print Preview in MDI environment
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 06:35 AM
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.

#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 07:10 AM
NageswaraRao,

Comment out this line in source\classes\rpreview.prg line 1261:
   if ! ::lZoom .and. ! lInit
      // ::Zoom( .T. )    A.L. 08 Oct 2007
   endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 07:29 AM

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 07:34 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 07:44 AM

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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 07:56 AM
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.

#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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 08:36 AM
Please make this little change into source\rpreview.prg. This change is already included in FWH 7.10:
   if ::oWnd != nil .and. IsIconic( ::oWnd:hWnd )
      return nil
   endif
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 08:52 AM
Thanks. Done. But this does not solve the problem fully. When ::oWnd is NIL, the execution goes to subsequent statements and fails at ::nWidth.

I tried making this change instead:

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
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Print Preview in MDI environment
Posted: Mon Oct 08, 2007 09:02 AM

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
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Print Preview in MDI environment
Posted: Tue Oct 09, 2007 01:43 PM

Antonio, my appl have this errors too, in workstations using windows nt 4 ocour. how to solve this? thanks

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Print Preview in MDI environment
Posted: Tue Oct 09, 2007 06:18 PM

Norberto,

We provide you a free upgrade for rpreview.prg

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 566
Joined: Thu Aug 30, 2007 03:40 PM
Print Preview in MDI environment
Posted: Tue Oct 09, 2007 06:37 PM

thanks, best regards.

Continue the discussion