I discovered that the project contains a German version of the Const.pas file, which triggers German messages in some circumstances. Could someone make an English version available?
TIA
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
*English version* of Delphi has an English version included :-D I have a French version with a French consts.pas. Of course, I could replace the German consts.pas with my French file (at least I would understand the message about the printer), but...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's nice to read you again.
> delphi has a english version included.
In fact, when a message in german appears, this means _bug_.
In my humble opinion, it's better to fix bugs
rather than to translate messages from german to english.
So, messages in german are excellent triggers.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The exception is triggered the first time this line is executed.
I should explain: My default printer is a remote printer which is on a network I have not connected to for 2 months!
I guess the exception could be trapped, but I am unable to find where to do it. Or the validity of the default printer should be checked first and the SynEditPrintPreview disabled in case of problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Excellent.
In order to fix, you could look at frmMain.pas near line 2309
<snip>
// Print Preview, only if there is a default printer. Checked only once, at launch
TabSheet9.TabVisible := Printer.Printers.Count > 0;
</snip>
Another property of the printer object should probably be checked...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Nope, it does not work. When the exception is triggered, I am inside a WndProc loop. FormCreate hasn't been called yet. I backtracked and found two tests:
SynEditPrintPreview 300 TSynEditPrintPreview.GetPageWidth100Percent
SynEditPrintPreview 490 TSynEditPrintPreview.SizeChanged
whith might have offered a possibility. So I put a breakpoint in TSynEditPrintPreview.SetSynEditPrint (SynEditPrintPreview:586), but at that point, all I have in the stack is DevPHP:89. I did try to put a try...except block around Application.CreateForm(TMainFrm, MainFrm), although I expected to crash the form loading (since initialization would be aborted), but actually it did not change anything. I don't know why I am unable to trap this exception.
The only solution I see is removing the TSynEditPrintPreview from frmMain, and in FormCreate: if the default printer is ok, create TSynEditPrintPreview and set it's properties.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I discovered that the project contains a German version of the Const.pas file, which triggers German messages in some circumstances. Could someone make an English version available?
TIA
delphi has a english version included.
*English version* of Delphi has an English version included :-D I have a French version with a French consts.pas. Of course, I could replace the German consts.pas with my French file (at least I would understand the message about the printer), but...
Hi Urs,
It's nice to read you again.
> delphi has a english version included.
In fact, when a message in german appears, this means _bug_.
In my humble opinion, it's better to fix bugs
rather than to translate messages from german to english.
So, messages in german are excellent triggers.
Nobodoy has a Latin consts.pas? It would make an even better trigger :-D Sorry, silly French humour.
Ok, then this means I found a bug. I'm trying to find where it comes from...
Found it!
Printers RaiseError
Printers TPrinter.SetState
Printers TPrinter.GetHandle
SynEditPrinterInfo 254 TSynEditPrinterInfo.UpdatePrinter
SynEditPrinterInfo 219 TSynEditPrinterInfo.GetXPixPrInch
SynEditPrintPreview 300 TSynEditPrintPreview.GetPageWidth100Percent
SynEditPrintPreview 490 TSynEditPrintPreview.SizeChanged
SynEditPrintPreview 649 TSynEditPrintPreview.WMSize
Controls TControl.WndProc
Controls TWinControl.WndProc
(...)
The exception is triggered the first time this line is executed.
I should explain: My default printer is a remote printer which is on a network I have not connected to for 2 months!
I guess the exception could be trapped, but I am unable to find where to do it. Or the validity of the default printer should be checked first and the SynEditPrintPreview disabled in case of problem.
Excellent.
In order to fix, you could look at frmMain.pas near line 2309
<snip>
// Print Preview, only if there is a default printer. Checked only once, at launch
TabSheet9.TabVisible := Printer.Printers.Count > 0;
</snip>
Another property of the printer object should probably be checked...
Nope, it does not work. When the exception is triggered, I am inside a WndProc loop. FormCreate hasn't been called yet. I backtracked and found two tests:
SynEditPrintPreview 300 TSynEditPrintPreview.GetPageWidth100Percent
SynEditPrintPreview 490 TSynEditPrintPreview.SizeChanged
whith might have offered a possibility. So I put a breakpoint in TSynEditPrintPreview.SetSynEditPrint (SynEditPrintPreview:586), but at that point, all I have in the stack is DevPHP:89. I did try to put a try...except block around Application.CreateForm(TMainFrm, MainFrm), although I expected to crash the form loading (since initialization would be aborted), but actually it did not change anything. I don't know why I am unable to trap this exception.
The only solution I see is removing the TSynEditPrintPreview from frmMain, and in FormCreate: if the default printer is ok, create TSynEditPrintPreview and set it's properties.