Page Setup Dialog?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
pax
Reply | Threaded
Open this post in threaded view
|

Page Setup Dialog?

pax
Hi,

while browsing the image, I noticed that there were no facilities
available for Page Setup. Before getting underway and hashing out the
details myself, I was wondering if anyone else has done this work.

End users want the ability to set the document size, source,
header/footers along with the orientation and margins. This is a
function that is located in the Common Dialog DLL or COMDLG32. As of
now, D6 only has the Print Dialog as a feature via PrintDialog
showModal.

My end users will print HTML generated reports and will have the need
to change certain settings at will. The only thing I can't offer them
right now is Page Preview, but that is also on my list of things to do
via the IWebBrowser2 control.

No use re-inventing the wheel if its not necessary. Otherwise, I will
add the Page Setup implementation of Page Setup to my (growing) list of
things to do.

Thanks,

Pax


Reply | Threaded
Open this post in threaded view
|

Re: Page Setup Dialog?

Janos Kazsoki
Pax,

Ian has a nice IDB Printer package. Perhaps it works also for html
documents.

Regards,
Janos


pax
Reply | Threaded
Open this post in threaded view
|

Re: Page Setup Dialog?

pax
Janos,

thanks for the information. I loaded up the appropriate packages and
have integrated method calls to bring up the Page Setup Dialog.

Now I just have to figure out how to save the settings.  I implemented
the following code, but I don't know how to capture the selections made
by the user.

pageSetup

        "Open a Dialog window so the user can make selections for the printer
setup"
        | aPrinter mySettings |
        aPrinter := Printer new.
        aPrinter setPrinterCanvas.
        mySettings := aPrinter showPageSetupDialog: true .
        (mySettings isNil ) ifTrue: [ ^self ].

I change the page orientation and paper size. Then re-open the setup
dialog and it shows the default settings. I guess I'm missing something
here.

If you know how to capture the settings for orientation and paper size
it wold be a big help.

Thanks,


Pax


Reply | Threaded
Open this post in threaded view
|

Re: Page Setup Dialog?

Ian Bartholomew-21
Pax,

>Now I just have to figure out how to save the settings.  I implemented
>the following code, but I don't know how to capture the selections made
>by the user.
[]
>If you know how to capture the settings for orientation and paper size
>it wold be a big help.

I'm afraid it's not that easy :-(  

 I spent many (happy?) hours trying to get the whole print setup/page
setup dialogs working and, although it all appears to work in my
printer goody, I'm still not convinced.  From memory and a quick look
at the code.

You have to pass an instance of the PAGESETUPDLG to the
PageSetupDialog - in that structure is a pointer to a DEVMODE and
DEVNAMES structure.  

PrintDialog ha it's own structure to use, PRINTDLG, and that also
contains a DEVMODE and DEVNAMES pointer.

DEVMODE is the structure that knows all about the page orientation
etc.

To get it all to work you have to arrange for the DEVMODE and DEVNAMES
structures to be shared between the two dialogs, so changes made in
the PageSetupDialog can be shown in the PrintDialog, and vice versa.

This all means that you can't really use the Dolphin PrintDialog class
at all - it's easier to do it yourself...

In my goody see

Printer>>showPageSetupDialog:
Printer>>showPrintDialog:selectionRange:

and, for when you need a PrinterCanvas

Printer>>setPrinterCanvas


I'm a bit pushed at the moment but if you have any questions I'll try
and answer them - it may just take a bit of time for me to get back to
you.
--
Ian

Use the Reply-To address to contact me (limited validity).
Mail sent to the From address is ignored.


Reply | Threaded
Open this post in threaded view
|

Re: Page Setup Dialog?

Chris Uppal-3
In reply to this post by pax
Pax wrote:

> while browsing the image, I noticed that there were no facilities
> available for Page Setup. Before getting underway and hashing out the
> details myself, I was wondering if anyone else has done this work.

In the 'Experiments' page on my website, there's a package 'CU Printing' (most
of which will probably not interest you -- and won't work on D6 anyway), which
contains a class CUPrintDialog.  That's my version of the Dolphin PrintDialog
class, and it exposes most (or all?) of the underlying settings.  It's built --
naturally -- on top of Ian's stuff ;-)   It looks as if a page setup dialog
would share a great deal of code with the print dialog[*], so that might help
you put a PageSettupDialog class together more easily.

    -- chris

([*] Having got curious about it, I'm currently playing with that myself...)


pax
Reply | Threaded
Open this post in threaded view
|

Re: Page Setup Dialog?

pax
Chris, Ian...

Thanks for the information. As my reports are HTML that is generated
via smalltalk, I plan to investigate the possibility of using the
IWebBrowser2 ActiveX control to handle Page Setup and if possible,
Print Preview. My applications already make use of IWebBrowser2 for
printing and the MSDN site has some discussions/examples for other
printing possibilities.

Thanks,


Pax