[wxWin 2.8.4 VC++ 6.0] Printing problems

Exadrina noM at il.it
Tue Oct 2 07:54:04 PDT 2007


I'm trying to add printing capability to my program, but I
had a lot of trouble.

First of all I implemented "page setup" capabilities, I've merely
copied the code of

MyFrame::OnPageSetup()

from $(WXWIN)/samples/printing directory. Changing paper type
(from A4 to A3, for example) seems to be a "no op", in fact
reopening the page setup dialog immediately after having changed
page settings, paper type is always A4.

You can observe the same behaviour, compiling and running
the print sample from the wx distribution.

I wasn't able to track why this happens.

Can anyone tell me how to obtain the correct behaviour?

I'm trying to obtain default page and printer settings too.

This is the code I wrote to achieve this

<begin code>

// This should permit to get default info without
// displaying the Diaolg Box
// ----------------------------------------------
   pgStpDlgDt.SetDefaultInfo(true);

   wxPageSetupDialog pgSetupDlg(edtCtrlP, &pgStpDlgDt);
   pgSetupDlg.ShowModal();

   pgStpDlgDt = pgSetupDlg.GetPageSetupDialogData();

</end code>


but at the end of the instructions sequence, I didn't get
what I would.

I think the problem is here

<begin code from src/msw/printdlg.cpp>

int wxWindowsPageSetupDialog::ShowModal()
{

[cutted code]

    BOOL retVal = PageSetupDlg( pd ) ;
    pd->hwndOwner = 0;
    if (retVal)
    {
        ConvertFromNative( m_pageSetupData );
        return wxID_OK;
    }
    else
        return wxID_CANCEL;
}

</end code>

The if() checks only the value returned by PageSetupDlg(),
but this is always FALSE if the Page Setup Dialog isn't
displayed.

I think the correct code should be

    if (retVal || pageSetupData.GetDefaultInfo())
    {

But I don't know which impact could have this on existing code.

Is there another way to obtain desired information?

Thanks

-- 

questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news segnala gli abusi ad abuse at newsland.it








More information about the wx-users mailing list