Hi.
I noticed that with new rPreview, the main app may close while the preview will stay open (does not close with the app). Although it stays open it becomes .NOT. operable. Any solution?
Thank you,
Reinaldo.
Hi.
I noticed that with new rPreview, the main app may close while the preview will stay open (does not close with the app). Although it stays open it becomes .NOT. operable. Any solution?
Thank you,
Reinaldo.
Reinaldo
Can you post a little sample to show the error?
Thanks
IF ::oDevice:lPrvModal
StopUntil( { || ::lExit } )
ENDIFPlease see
viewtopic.php?f=3t=20693p=110112hilit=rpreview#p110112
This issue is not from the new rpreview
&&&
Rao; Hi. Appreciate your efforts. Don't take me wrong -this is not an attack. I don't know what you mean by "is not from the new preview". Once upon a time, it was not a problem. Now it is. Is it from new-little less new-new-newest-newer..... does not matter. It is still an issue. Actually, an unresolved issue.
Daniel; Hola, que tal?. If you really want a self contained small sample, I'll be glad to provide it. But you can reproduce this problem yourself with any fw app. Just open a preview window and then close the main app window. You will see. As Rao implies, it is a documented-unresolved problem. I'm thinking that hardly anybody is using [newer] rpreviews anymore. Could this be the case?
Ramesh; Thank you. I will try removing the clause. But then again, why is it there in the first place?
With kind regards to you all,
Reinaldo.
This happened to me when using FWH 10.12, Backward rpreview.
Repexcel I used to export to Excel, and since it is impossible for this reason.
*--------------------------------------------------------------------------------------
function AddExportBtns( oPreview, oBar, oReport )
local aRet
Local cpdfName
cPdfName := alltrim( GetTempDir() + ;
AllTrim( StrTran( StrTran( oPreview:oDevice:cDocument, "/", "-" ), " ", "_" ) ) ) + ".pdf"
aRet := { { "Excel", "Export to Excel",;
{|| oReport:SaveAs( "EXCEL" ) }, "Excel" },;
{ "Pdf", "Export to Pdf Document",;
{ || BuildPdf( oPreview:oDevice:aMeta, cpdfName, .f., .t. ) }, "Pdf" } }
Return aRet*--------------------------------------------------------------------------------------
METHOD New( aTitle, aHead, aFoot, aFont, lSummary, cRptFile, ;
cResName, lPrinter, lScreen, cFile, oDevice, ;
cName, cTFmt, cHFmt, cFFmt ) CLASS TMReport
Local uReturn := Super:New( aTitle, aHead, aFoot, aFont, lSummary, cRptFile, ;
cResName, lPrinter, lScreen, cFile, oDevice, ;
cName, cTFmt, cHFmt, cFFmt )
If Empty( uReturn ) // Error
Return Nil
EndIf
//rPrevUserBtns is a new function in rPreview.prg
RPrevUserBtns( { |oPreview, oBar| addExportBtns( oPreview, oBar, Self ) } )
::bPreview := { |oDevice, oRpt| rPreview( oDevice, oRpt ) }
Return Self//----------------------------------------------------------------------------//
METHOD BuildButtonBar() CLASS TPreview
local oThis := Self
local oBtn
local oReBar, oBar, oWndMain
local l97Look := ::oWndMain != nil .and. ::oWndMain:oBar != nil .and. ;
Len( ::oWndMain:oBar:aControls ) > 0 .and. ;
::oWndMain:oBar:aControls[ 1 ]:l97Look
local aPreviewBtns, aBtn
DEFINE CURSOR ::oHand HAND
if WndMain() != nil
if WndMain():oBar != nil
oBar = WndMain():oBar
if oBar != nil .and. Upper( oBar:ClassName() ) == "TBAR" .and. oBar:l2007
l2007 = .T.
endif
endif
endif
if !empty( bUserBtns )
aPreviewBtns := Eval( bUserBtns, Self, oBar )
endif
oBar := TBar():New( ::oWnd, 50, 60, .F.,,, .T. )
TBtnBmp():NewBar( "Top",,,,, {|| ::TopPage() }, .F., oBar, .F.,,;
"First Page", .F.,,,, "First",,,,,,,,, .F. )
TBtnBmp():NewBar( "Previous",,,,, { || ::PrevPage() }, .F., oBar, .F.,,;
"Prev Page", .F.,,,, "Prev",,,,,,,,, .F. )
TBtnBmp():NewBar( "Next",,,,, {|| ::NextPage()}, .F., oBar, .F.,,;
"Next Page", .F.,,,, "Next",,,,,,,,, .F. )
TBtnBmp():NewBar( "Bottom",,,,, {|| ::BottomPage() }, .F., oBar, .F.,,;
"Last Page", .F.,,,, "Last",,,,,,,,, .F. )
TBtnBmp():NewBar( "Zoom",,,,, {|| ::zoom() }, .T., oBar, .F.,, ;
"Zoom", .F.,,,, "Zoom",,,,,,,,, .F. )
TBtnBmp():NewBar( "Two_Pages",,,,, {||::TwoPages() }, .F., oBar, .F.,,;
"View two pages side by side", .F.,,,,"Two Pages",,,,,,,,, .F. )
TBtnBmp():NewBar( "Printer",,,,, {|| ::PrintPage() }, .F., oBar, .F.,, ;
"Print", .F.,,,, "Print",,,,,,,,, .F. )
if aPreviewBtns != Nil .and. valtype( aPreviewBtns ) = "A" .and. ;
len( aPreviewBtns ) > 0
FOR EACH aBtn IN aPreviewBtns
TBtnBmp():NewBar( aBtn[ 1 ],,,,, aBtn[ 3 ], .F., oBar, .F.,, ;
aBtn[ 2 ], .F.,,,, aBtn[ 4 ],,,,,,,,, .F. )
NEXT
endif
oBtn := TBtnBmp():NewBar( "Exit",,,,, {|| oThis:oWnd:end() }, .F., oBar, .F.,, ;
"Exit", .F.,,,, "Exit",,,,,,,,, .F. )
@ 7, oBtn:nRight + 5 SAY ::oSay PROMPT "Factor:" SIZE 45, 15 PIXEL OF oBar FONT ::oFont
::oSay:lTransparent = .T.
@ 3, oBtn:nRight + 50 COMBOBOX ::oFactor VAR ::nZFactor ;
ITEMS { "1", "2", "3", "4", "5", "6", "7", "8", "9" } ;
OF oBar FONT ::oFont PIXEL SIZE 35,200 ;
ON CHANGE oThis:SetFactor( oThis:nZFactor )
if Len( ::oDevice:aMeta ) > 1
@ 7, oBtn:nRight + 95 ;
SAY ::oPage PROMPT TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) + " / " + ;
LTrim( Str( Len( ::oDevice:aMeta ) ) ) ;
SIZE 180, 15 PIXEL OF oBar FONT ::oFont
else
@ 7, oBtn:nRight + 95 ;
SAY ::oPage PROMPT TXT_PAGENUM + LTrim( Str( ::nPage, 4, 0 ) ) ;
SIZE 180, 15 PIXEL OF oBar FONT ::oFont
endif
::oPage:lTransparent = .T.
// AEval( oBar:aControls, { | o | o:oCursor := ::oHand } )
return nilMETHOD Activate() CLASS TPreview
ACTIVATE WINDOW ::oWnd MAXIMIZED ;
ON RESIZE ::PaintMeta() ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
::oWnd := nil ,;
::lExit := .T. ,;
.T. )
if ::oDevice:lPrvModal
StopUntil( { || ::lExit } ) //<------ Look here.
endif
return nilReinaldo,
You could try, when defining the report, something like this:
wndMain():bValid := {|| oRpt:lEnd := .t., .t.}
This should end the preview when the main window is closed.
Regards,
James
DO WHILE !Eval( bBlock ) .and. WndMain() != NIL .and. IsWindow( WndMain():hWnd ) if ::hWnd != 0 .and. GetWndApp() == ::hWnd
PostQuitMessage( 0 )
Sysrefresh()
QUIT
endifJames Bott wrote:Reinaldo,
You could try, when defining the report, something like this:
wndMain():bValid := {|| oRpt:lEnd := .t., .t.}
This should end the preview when the main window is closed.
Regards,
James
METHOD Activate() CLASS TPreview
local bValidMain := If( ::oWndMain == nil, nil, ::oWndMain:bValid )
ACTIVATE WINDOW ::oWnd MAXIMIZED ;
ON RESIZE ::PaintMeta() ;
ON UP ::VScroll( GO_UP ) ;
ON DOWN ::VScroll( GO_DOWN ) ;
ON PAGEUP ::VScroll( GO_UP, GO_PAGE) ;
ON PAGEDOWN ::VScroll( GO_DOWN, GO_PAGE) ;
ON LEFT ::HScroll( GO_LEFT ) ;
ON RIGHT ::HScroll( GO_RIGHT ) ;
ON PAGELEFT ::HScroll( GO_LEFT, GO_PAGE ) ;
ON PAGERIGHT ::HScroll( GO_RIGHT, GO_PAGE ) ;
VALID ( ::oWnd:oIcon := nil ,;
::oFont:End() ,;
::oMeta1:End() ,;
::oMeta2:End() ,;
::oDevice:End() ,;
::oHand:End() ,;
If( ::oWndMain == nil,, ::oWndMain:bValid := bValidMain ),;
::oWnd := nil ,;
If( IsAppThemed() .and. ! l2007, ::oImageList:End(),),;
::lExit := .T. ,;
.T. )
if ::oWndMain != nil
if bValidMain == nil
::oWndMain:bValid := { || ::lExit := .t. }
else
::oWndMain:bValid := { || If( Eval( bValidMain ), ::lExit := .t., .f. ) }
endif
endif
if ::oDevice:lPrvModal
StopUntil( { || ::lExit } )
endif
return nil
//----------------------------------------------------------------------------//James Bott wrote:wndMain():bValid := {|| oRpt:lEnd := .t., .t.}
wndMain():bValid := {|| oRpt:lEnd := .t.} if ::oDevice:lPrvModal
StopUntil( { || ::lExit .or. WndMain() == Nil .or. !IsWindow( WndMain():hWnd ) } )
endifJosé Luis;
I wish to talk more about repexcel. I`m starting a new thread on the Spanish forum. Please look for it. Thank you.
Reinaldo.