|
|
Home » U++ Library support » RichText,QTF,RTF... » Name of a print job is missing
Name of a print job is missing [message #5422] |
Thu, 21 September 2006 01:48 |
zsolt
Messages: 697 Registered: December 2005 Location: Budapest, Hungary
|
Contributor |
|
|
When printing Report object, the name of the job is missing in the list of pending jobs.
Fix is simple:
In Report/Reportdlg.cpp change Print() from
bool Print(Report& r, int i, const char *_name) {
PrinterJob pd;
to
bool Print(Report& r, int i, const char *_name) {
PrinterJob pd(_name);
|
|
|
|
|
|
|
|
|
|
|
Re: Name of a print job is missing [message #6462 is a reply to message #6461] |
Mon, 13 November 2006 11:49 |
|
mirek
Messages: 13975 Registered: November 2005
|
Ultimate Member |
|
|
OK this seem to work fine for all cases:
bool PrinterJob::Execute0(bool dodlg)
{
pdlg = new Win32PrintDlg_;
PRINTDLG& dlg = *pdlg;
dlg.Flags = PD_DISABLEPRINTTOFILE|PD_NOSELECTION|PD_HIDEPRINTTOFILE|PD_RETURNDEFAULT;
dlg.nFromPage = current;
dlg.nToPage = current;
dlg.nMinPage = from;
dlg.nMaxPage = to;
if(from != to)
dlg.Flags |= PD_ALLPAGES;
dlg.hwndOwner = GetActiveWindow();
dlg.Flags |= PD_RETURNDEFAULT;
if(!PrintDlg(&dlg)) return false;
if(dlg.hDevMode) {
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(dlg.hDevMode);
pDevMode->dmOrientation = landscape ? DMORIENT_LANDSCAPE : DMORIENT_PORTRAIT;
::GlobalUnlock(dlg.hDevMode);
}
HDC hdc;
if(dodlg) {
dlg.Flags = PD_DISABLEPRINTTOFILE|PD_NOSELECTION|PD_HIDEPRINTTOFILE|PD_RETURNDC;
if(!PrintDlg(&dlg)) return false;
hdc = dlg.hDC;
}
else {
DEVNAMES *p = (DEVNAMES *)::GlobalLock(dlg.hDevNames);
String driver = (const char *)p + p->wDriverOffset;
String device = (const char *)p + p->wDeviceOffset;
if(dlg.hDevMode) {
DEVMODE *pDevMode = (DEVMODE*)::GlobalLock(dlg.hDevMode);
hdc = CreateDC(driver, device, NULL, pDevMode);
::GlobalUnlock(dlg.hDevMode);
}
else
hdc = CreateDC(driver, device, NULL, NULL);
}
if(dlg.hDevMode)
::GlobalFree(dlg.hDevMode);
if(dlg.hDevNames)
::GlobalFree(dlg.hDevNames);
if(hdc) {
draw = new PrintDraw(hdc, Nvl(name, Ctrl::GetAppName()));
page.Clear();
if(!(dlg.Flags & PD_PAGENUMS)) {
dlg.nFromPage = dlg.nMinPage;
dlg.nToPage = dlg.nMaxPage;
}
for(int c = 0; c < ((dlg.Flags & PD_COLLATE) ? dlg.nCopies : 1); c++)
for(int i = dlg.nFromPage - 1; i <= dlg.nToPage - 1; i++)
for(int c = 0; c < ((dlg.Flags & PD_COLLATE) ? 1 : dlg.nCopies); c++)
page.Add(i);
return true;
}
return false;
}
testcase (puttin' that to reference):
#include <CtrlLib/CtrlLib.h>
GUI_APP_MAIN
{
PrinterJob pj;
if(PromptYesNo("Landscape?"))
pj.Landscape();
if(!PromptYesNo("Use default printer?"))
pj.Execute();
Draw& w = pj;
w.StartPage();
w.DrawText(0, 0, "Hello world!", Roman(100));
w.EndPage();
}
Mirek
|
|
|
|
Goto Forum:
Current Time: Thu Apr 25 18:17:25 CEST 2024
Total time taken to generate the page: 0.02938 seconds
|
|
|