Post by Robert LuchnerPost by Leonti BielskiHi! Thanks for answering!
I'm a little lost there. Are you overriding OnInit() and SetPrinterName()
of wxPrintDialog?
I do not override the OnInit etc of wxPrintDialog.
OnInit() and SetPrinterName() are methods of MY BaseClass <IkStmRFNewGre>
to initalize m_printData and m_pageSetupData and the variables m_printData
and m_pageSetupData are defined in the class IkStmRFNewGre.
Post by Leonti BielskiWhere dialog actually gets called?
I have Buttons in the dialog (in the BaseClass IkStmRFNewGre to call the
printer and also the page layout
void IkStmRFNewGre::OnPrinter(wxCommandEvent &event)
{
wxPrintDialogData printDialogData(*m_printData);
wxPrinter printer(&printDialogData);
wxDC* dc;
if (dc = printer.PrintDialog(this))
{
(*m_printData) = printer.GetPrintDialogData().GetPrintData();
(*m_pageSetupData) = *m_printData;
SetPrinterName();
delete dc;
}
event.Skip();
}
void IkStmRFNewGre::OnSeite(wxCommandEvent& event)
{
wxPageSetupDialog pageSetupDialog(this, m_pageSetupData);
pageSetupDialog.ShowModal();
(*m_printData) = pageSetupDialog.GetPageSetupData().GetPrintData();
(*m_pageSetupData) = pageSetupDialog.GetPageSetupData();
SetPrinterName();
event.Skip();
}
What is the trick to get printer name?
There is no trick to get the printer name!
If you initialize the printer data in the OnInit() and you don't call
ConvertToNative and ConvertFramNative then the printerData are not
initialized.
If you call both methods you get the inital values without a call to to
wxPrintDialog.
Post by Leonti BielskiWhat is StrGleich function?
Sorry this function is an old function in C to compare both arguments.
If the variable druckerName and printerName are the same you get true
return. And if there is the same name i take the standard printer name of
empty value.
Post by Leonti BielskiLeonti
Hello!
I want to call a PrintDialog just to set printing properties.
Not before the actual printing but like program settings for
future printing.
http://pastebin.com/m5c9947f6
The problem is that printer name is always an empty string.
Also tried to check for printdata1 -> GetCollate(); and it's
always false. No matter what I'm doing in popped up dialog.
What am I doing wrong?
Thanks in advance.
Leonti
p.s. Posted the same question on forum, but since I've got no
reply trying the same thing here.
------------------------------------------------------------------------
_______________________________________________
wx-users mailing list
http://lists.wxwidgets.org/mailman/listinfo/wx-users
void IkStmRFNewGre::OnInit()
{
m_printData = (wxPrintData*)NULL;
m_pageSetupData = (wxPageSetupData*)NULL;
m_printData = new wxPrintData;
// both ConvertToNative and ConvertFromNative must be called!!!
m_printData->ConvertToNative();
m_printData->ConvertFromNative();
m_pageSetupData = new wxPageSetupDialogData();
(*m_pageSetupData) = *m_printData;
m_pageSetupData->SetMarginTopLeft(wxPoint(20, 20)); //
Std-Rand Links-Oben
m_pageSetupData->SetMarginBottomRight(wxPoint(20, 20)); //
Std-Rand Rechts-Unten
SetPrinterName();
}
void IkStmRFNewGre::SetPrinterName()
{
wxPrintData printData;
printData.ConvertToNative();
printData.ConvertFromNative();
// Wenn Druckername gleich == "" --> Standarddrucker
WTEXT druckerName[MAXSTR];
WTEXT printerName[MAXSTR];
strcpy((char*)druckerName, printData.GetPrinterName().c_str());
strcpy((char*)printerName, m_printData->GetPrinterName().c_str());
if (StrGleich(druckerName, printerName))
m_printData->SetPrinterName(wxT(""));
}
In Windows (Vista) it seems to be OK!
By
Robert Luchner
_______________________________________________
wx-users mailing list
http://lists.wxwidgets.org/mailman/listinfo/wx-users
------------------------------------------------------------------------
_______________________________________________
wx-users mailing list
http://lists.wxwidgets.org/mailman/listinfo/wx-users
_______________________________________________
wx-users mailing list
http://lists.wxwidgets.org/mailman/listinfo/wx-users