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