Menu

const.pas

2008-06-19
2012-12-07
  • Frederic Da Vitoria

    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

     
    • Urs Mäder

      Urs Mäder - 2008-06-19

      delphi has a english version included.

       
      • Frederic Da Vitoria

        *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...

         
      • Pierre Fauconnier

        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.

         
        • Frederic Da Vitoria

          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...

           
          • Frederic Da Vitoria

            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.

             
            • Pierre Fauconnier

              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...

               
              • Frederic Da Vitoria

                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.

                 

Log in to post a comment.

MongoDB Logo MongoDB