After report runs all my dialogs appear

After report runs all my dialogs appear

Postby Rick Lipkin » Wed Feb 18, 2009 10:12 pm

To All

I am going nuts here trying to figure out why when I run a simple report from a modal dialog several dialogs deep .. when the report previewer comes up .. the previewer goes behind all my dialogs ..

I do not want my dialogs to come to the forefront .. I want them to stay behind the previewer until it is closed. I have remmed out the MDIchild clause in rpreview

Code: Select all  Expand view

 if ::oWndMain != nil .and. Upper( ::oWndMain:ClassName() ) == "TMDIFRAME"
      DEFINE WINDOW ::oWnd ;
         TITLE cTitle ;
         COLOR CLR_BLACK,CLR_LIGHTGRAY      ;
         ICON  oIcon                        ;
         VSCROLL HSCROLL // MDICHILD
   else
      DEFINE WINDOW ::oWnd FROM 0, 0 TO 24, 80  ;
         TITLE cTitle ;
         COLOR CLR_BLACK,CLR_LIGHTGRAY      ;
         ICON  oIcon                        ;
         VSCROLL HSCROLL MENU ::BuildMenu()
   endif

 


and still when the previewer comes up .. all my dialogs take the forground and I have to close all of them before I can get to the previewer ..

Here is my code from the report

Code: Select all  Expand view

STATIC oDLG

#INCLUDE "FIVEWIN.CH"

//----------------------
Func _GenLett( cLETTEREID, cMODE, lGEN, dDATE_SENT, oRsCert )

LOCAL mVIEW, lOK

lOK   := .F.
mVIEW := "V"

DEFINE DIALOG oDlg RESOURCE "GENLETT"            ;
       TITLE "AUTOMATED Letter Print routine"    ;

   REDEFINE GET mVIEW ID 117 of oDlg PICTURE "@!";
            valid mVIEW $ 'PV' UPDATE

   REDEFINE BUTTON oBTN1 ID 111              ;
       ACTION ( lOK := _doit( cLETTEREID, cMODE, lGEN, dDATE_SENT, oRsCert, mVIEW ))

   REDEFINE BUTTON oBTN2 ID 112              ;
       ACTION ( oDLG:End() )

ACTIVATE DIALOG oDlg

RETURN(lOK )

//------------------------
Static Func _Doit( cLETTEREID, cMODE, lGEN, dDATE_SENT, oRsCert, mVIEW )

LOCAL SAYING,oPRINT, oFONT, cTEXT
LOCAL oRsLett, cSQL, oERR, cDEFA,cTITLE

IF empty( cLETTEREID ) .or. cLETTEREID = "BOGUS"
   SAYING := "There were no parameters for the Letter EID"
   MsgInfo( SAYING )
   oDlg:End()
   RETURN(.F.)
ENDIF

IF lGEN = .F.
   SAYING := "The lGen parameters resolved to FALSE"
   MsgInfo( SAYING )
   oDlg:End()
   RETURN(.F.)
ENDIF

IF empty( dDATE_SENT ) .or. dDATE_SENT = CTOD("")
   SAYING := "It appears there was not a Legacy date sent"+chr(10)
   SAYING += "so there is nothing to Print or Re-print"
   MsgInfo( SAYING )
   oDlg:End()
   RETURN(.F.)
ENDIF

IF cMODE = "R"
   cTITLE := "RE-Generating letter"
ELSE
   cTITLE := "Creating Letter"
ENDIF

oRsLett := TOleAuto():New( "ADODB.Recordset" )
oRsLett:CursorType     := 1        // opendkeyset
oRsLett:CursorLocation := 3        // local cache
oRsLett:LockType       := 3        // lockoportunistic

cSQL := "SELECT * FROM LETTERS where LETTEREID = '"+cLETTEREID+"'"

TRY
  oRsLett:Open( cSQL,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
   MsgInfo( "Error in Opening LETTERS table" )
  oDlg:End()
  RETURN(.F.)
END TRY

IF oRsLett:eof
   oRsLett:Close()
   SAYING := "Sorry .. there is not any Letters associated with this Task"
   MsgInfo( saying )
   oDlg:End()
   RETURN(.F.)
ENDIF

IF mVIEW = "V"
   PRINTER oPRINT FROM USER                ;
   PREVIEW                                 ;
   NAME cTITLE+" for   "+xLOGIN

ELSE

   PRINTER oPRINT from USER                ;
   NAME cTITLE+" for "+xLOGIN

   IF EMPTY( oPRINT:hDC )
      MsgStop ( "Printer not Ready !" )
      oDlg:End()
      RETURN(.F.)
   ENDIF

ENDIF

SysReFresh()
CursorWait()

cTEXT := oRsLett:Fields("letter_text"):Value
oRsLett:Close()

oPRINT:lPrvModal:= .T.

DEFINE FONT oFont NAME "Courier New" SIZE 0,-10 BOLD of oPRINT  // SIZE 10 -40

oPRINT:StartPage()

cDEFA := SET(7)
IF FILE( cDEFA+"\AGENCY.BMP" )
   oPRINT:SayBitMap( 10,1000, cDEFA+"\AGENCY.BMP", 600,600 )    //800,500
ENDIF

oPRINT:EndPage()
CursorArrow()

OdLG:END()

IF mVIEW = 'V'
   oPRINT:Preview()
ELSE
   PrintEnd()
ENDIF

oFONT:END()
RELEASE FONT oFont

RETURN(.T.)

// end GennLett.prg
 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: After report runs all my dialogs appear

Postby Antonio Linares » Thu Feb 19, 2009 11:14 am

Rick,

You should specify the window container of the first dialog so they will not go foreground:
Code: Select all  Expand view
DEFINE DIALOG oDlg RESOURCE "GENLETT"            ;
       TITLE "AUTOMATED Letter Print routine" ;
       OF oWndMain
 

where oWndMain is your main window.

Also you modification in rpreview.prg is fine. We need to set a parameter for this, so there is no need to modify it in the future.

Please try it and let me know how it goes, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: After report runs all my dialogs appear

Postby Rick Lipkin » Fri Feb 20, 2009 2:59 pm

Antonio

I made sure I passed the main MDI Window object to all child process and dialogs down to the print routine .. still having the same problem when the previewer comes up .. all my dialogs come to the forefront and I have to close them all to get to the preview .. :cry:

If I just send the job to the printer without envoking rpreview .. I am fine .. however, I would prefer letting the user see the document first before printing ..

Any other thoughts ?

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: After report runs all my dialogs appear

Postby Antonio Linares » Fri Feb 20, 2009 5:39 pm

Rick,

Please post a screenshot, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: After report runs all my dialogs appear

Postby Rick Lipkin » Fri Feb 20, 2009 6:34 pm

Antonio

I do not have access to any external file hosting sites .. ( blocked at work) .. I will send it to your private e-mail.

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: After report runs all my dialogs appear

Postby James Bott » Fri Feb 20, 2009 6:36 pm

Rick,

Perhaps this is a design issue. Normally dialogs have OK and Cancel buttons and when either button is pressed the dialog is closed. If you use this design then you will eliminate your problem.

If you wish to use a design where the dialog remains open, then the dialogs should be non-modal and perhaps this will fix your problem.

I would use the first design.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: After report runs all my dialogs appear

Postby Rick Lipkin » Fri Feb 20, 2009 7:20 pm

James

I have sent you the same private e-mail I sent Antonio .. I am using one MDI main menu which calls a child .. from there all the dialogs ascending are modal.

Sending the last two modules that go with it.

Let me know if you see anything wrong ..

Thanks
Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: After report runs all my dialogs appear

Postby Antonio Linares » Fri Feb 20, 2009 7:22 pm

Rick,

The preview window remains MDICHILD, thats why its placed behind the dialogs.

You may not have properly modified rpreview.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: After report runs all my dialogs appear

Postby Rick Lipkin » Fri Feb 20, 2009 7:43 pm

Antonio

You won't believe this .. I modified rpreview and your msginfo showed up .. and after I closed the msginfo .. the preview worked perfect .. Damned strange ..

Apparently xMate even when rpreview.prg in the compile list .. did not compile the program .. perhaps a date attribute problem.. I took out the msgbox and everything works !! ..

Had to be a date stamp problem on the file :shock:

Thanks for the help !!

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: After report runs all my dialogs appear

Postby Antonio Linares » Fri Feb 20, 2009 8:10 pm

Rick,

glad to know it is solved :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: After report runs all my dialogs appear

Postby Rick Lipkin » Fri Feb 20, 2009 9:08 pm

To All

Here is what the fix was .. for some reason Rpreview.prg was not getting compiled and linked into the application .. even though it is in the compile and link list.

I had this very strange and wierd thing happen with another program I was working on .. I went in and re-named my project folder .. re-compiled and things worked ..

In this case .. there was nothing wrong with the code, design, dialogs, MDI object .. for some dumb odd reason .. Rpreview was just not being compiled and linked into my program.

It was Antonio that got me to realize this with the msginfo() in the rpreview code .. it just never fired .. but re-name the entire project folder and do a total re-compile .. and it works .. rename the folder back again .. recompile and Rpreview never gets linked in..

All I can say is there has to be a global variable in xMate that is not being evaluated correctly .. when I rename the folder .. everyting gets re-compiled along with rpreview.

Thanks for everyone support on this

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 83 guests