wxPrintout page number clarification
Ian Britten
britten at caris.com
Tue Oct 23 10:09:50 PDT 2007
Hi all,
Rather than keep flailing with the my wxPrintout page number
confusion, I figured I'd get some straight answers here...
[ Note I'm currently working with wxGTK v2.8.4, GTK 2.6.4, but
hopefully all this info is independent of platform/version... ]
I've got a (custom) graphic canvas that I want to print on a single
page. As such, there is only one page of output, and all page
controls are of no interest to me in this case.
wxPrintout::GetPageInfo()
According to the docs, "If minPage is zero, the page number controls
in the print dialog will be disabled". This doesn't seem to be true
for me, in that the page forward/back, first/last, etc button can
still be pressed (And trigger corresponding wx calls).
Are the docs wrong? Or is this a bug? Or maybe my old version?
MyPrintout::GetPageInfo(int *minPage, int *maxPage,
int *pageFrom, int *pageTo)
{
*minPage = 0; // Disable page controls
*maxPage = *pageFrom = *pageTo = 1;
}
wxPrintout::HasPage()
"By default, HasPage behaves as if the document has only one page"
Since this is the behaviour I want, I normally don't override this
method. However, if I do, I find that it's called with both zero
and one as input parameters when I hit the print preview controls,
even though I'm configuring for one page of output. Why am I
getting two dofferent page numbers?
Also, is the parameter zero-based or one-based? Which one of the
two calls is correct for my one-page output?
wxPrintout::OnPrintPage()
As with wxPrintout::HasPage(), is the parameter zero-based or
one-based? I could simply ignore it, but I'd like to check that
things are working as expected. It seems that I get different
values, depending on whether I'm doing a print-preview (one),
or a real print (zero), for which I have no explanation.
Thanks for any info!
Ian
More information about the wx-users
mailing list