How destroy a preview report object

How destroy a preview report object

Postby Piscicelli Zingoni » Mon Oct 24, 2005 7:55 am

Hi,
if have:
report oRep preview
.
.
.
end report
.
.
i need later to destroy the preview (also to avoid a second prevew error)

i tried with
oRep:end() and also
oRep:oDevice:end() but them dont work !

Any help ?
Tks
Piscicelli/Zingoni
Piscicelli Zingoni
 
Posts: 76
Joined: Wed Oct 12, 2005 5:52 pm
Location: Milan,Italy

Postby Vladimir Grigoriev » Mon Oct 24, 2005 8:45 am

I advice to define all objects (as all other program variables) as local (or static). After performing the general destroy method for most of objects (oObject:end()) assign NIL value to a object variable. I.e.

oObject:end()
oObject := NIL

I usually use the following command for the statements above
RELEASE OBJECT oObject
where OBJECT should be replaced with the specific class name
For example
RELEASE METER oMeter.
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Re: How destroy a preview report object

Postby Enrico Maria Giordano » Mon Oct 24, 2005 9:30 am

I think you would have to End() the preview window but its variable oWnd is static inside rpreview.prg. I don't think it's possible to do what you're asking for without modifying rpreview.prg.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Vladimir Grigoriev » Mon Oct 24, 2005 10:06 am

In my turn I think that there is no matter how oWnd is declared. Either a new report object should (and indeed does) rerwite oWnd value or the end() method should assign it to NIL (I have not seen the source code; it is general remarks). If this is not the truth then class REPORT should be corrected.
Vladimir Grigoriev
 
Posts: 54
Joined: Fri Oct 21, 2005 10:45 am
Location: Russia, Moscow

Re: How destroy a preview report object

Postby Enrico Maria Giordano » Mon Oct 24, 2005 10:28 am

I agree, but I don't think it is possible as TReport is today.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Tue Feb 19, 2008 11:28 am

Is there a solution for closing preview from outside the preview available.
Regards,
Otto
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Tue Feb 19, 2008 11:34 am

If you have created the TPreview object for yourself then try

Code: Select all  Expand view  RUN
oPreview:oWnd:End()


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Tue Feb 19, 2008 3:28 pm

Hello Enrico,

I tried your suggestion but it does not work.

> If you have created the TPreview object for yourself then try
no. PRINTER created the TPreview

I had a look into printer-class:

METHOD Preview() INLINE If( ::lMeta .and. Len( ::aMeta ) > 0 .and. ::hDC != 0,;
RPreview( Self ), ::End() )

If I understand this right printer calls Rpreview and Printer is ended.

So there is no connection anymore to the event which called the Rpreview.

If you look into Property Inspector the Parent Window of Preview is the MainWindow of the application.
Regards,
Otto
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Tue Feb 19, 2008 3:34 pm

Without the handle to the TPreview object you can't close it.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Tue Feb 19, 2008 4:17 pm

Do you maybe know a way how to get a handle?

Regards,
Otto
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm

Postby Enrico Maria Giordano » Tue Feb 19, 2008 4:49 pm

Through FindWindow(), but you must know the title of the preview window.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8718
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Otto » Tue Feb 19, 2008 5:10 pm

Thank you Enrico.

That’s what I do now.

I changed printer.prg

printer.prg
DATA cFile

METHOD New( cDocument, lUser, lMeta, cModel, lModal, lSelection, cFile ) CONSTRUCTOR

METHOD ImportWMF( cFile, lPlaceable ) CLASS TPrinter
local hMeta, hOld, hWMF
local aData := PrnGetSize( ::hDC )
local aInfo := Array( 5 )

::cFile := cFile



and preview.prg
rprinter.prg
cTitle := ::oDevice:cFile

Now I have the title and with FindWindow() I will – I hope so –
get the handle.

Thanks again,
Regards,
Otto
User avatar
Otto
 
Posts: 6334
Joined: Fri Oct 07, 2005 7:07 pm


Return to FiveWin for CA-Clipper

Who is online

Users browsing this forum: No registered users and 5 guests