FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Preview-How to pass a parameter
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 08:57 AM
Preview
Could someone suggest an easy way to pass a parameter to preview?

In certain cases I need more buttons than the standard preview menu has.
How could I pass a parameter for example cCalledFrom to rpreview to know which function called the preview to adapt the menu.

If cCalledFrom = “Billing”

DEFINE BUTTON RESOURCE "Printer" OF oBar GROUP ;
MESSAGE TXT_PRINT_CURRENT_PAGE ;
ACTION f_name() ;
prompt "T e s t" TOOLTIP Strtran(TXT_PRINT,"&","")

endif

Thanks in advance
Otto
Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Re: Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 09:35 AM

Otto

I write to a txt file username.txt and the preview checks to see if the file is there, it erases it at the end

Hth

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 10:08 AM

Richard, thank you for your tip.
How do you care if the txt is deleted after printing. What if the system crashes.

Regards,
Otto

Posts: 946
Joined: Thu Oct 06, 2005 07:05 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 10:17 AM

Otto

if i understood correctly your question, the data is needed to be used by the preview, so it has to be deleted after printing in order to load some other data if needed next time.

The file i use is unique per user, so the information is there. The name of the file is retreived from netname() + '.txt' . i use it to pass to the preview the customer's email from the customer file and then the preview email's at the correct address.

Another solution would be to chane the preview and add data to the classs , cargo or anything else.

This depends what you want to do at preview

Hth

Richard

http://www.cbati.com

Uestudio
Fwh 13.05 Harbour 3.2 MSVC 2013
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 10:47 AM
Richard Chidiak wrote:Another solution would be to chane the preview and add data to the classs , cargo or anything else.


Or, better, inherit from TPreview and add to the inherited class what you need to.

EMG
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 10:56 AM

Thank you for your answers.

Enrico, do you have some code how this could be done.

Do I have to start in printer.prg which calls rpreview?

Do you think this could work?

add xPreview to printer.prg

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

and add xRPreview.prg with the changes.

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 10:59 AM
Otto wrote:Enrico, do you have some code how this could be done.


No, sorry.

Otto wrote:Do I have to start in printer.prg which calls rpreview?


Yes, TPreview is used by TPrinter so you have to inherit a class from TPrinter also, I'm afraid.

EMG
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 11:01 AM

Sorry Enrico, I edited my post. Could you please read the post again?

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 11:05 AM
Otto wrote:Do you think this could work?

add xPreview to printer.prg

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

and add xRPreview.prg with the changes.


Yes, but the problem in creating a modified copy of rpreview.prg is that you have to apply to it any changes/fixes made later to the original file. I recommend inheritance instead.

EMG
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 11:10 AM

Enrico, if you inherit a class could you also overwrite the new method?

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 11:23 AM

Otto,

yes

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 11:34 AM

Antonio
if I use in the inherited class, example xPrinter from TPrinter

METHOD New(cMyData ) CONSTRUCTOR

do I have all the data in the new class

METHOD New( cDocument, lUser, lMeta, cModel, lModal, lSelection ) CONSTRUCTOR
plus
cMyData?
Thanks in advance
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Preview-How to pass a parameter
Posted: Tue Nov 13, 2007 12:01 PM

Otto,

yes

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion