Jump to content

Denis Dresse

Members
  • Content Count

    11
  • Joined

  • Last visited

Posts posted by Denis Dresse


  1. With Delphi 11.3, the build time of a big project takes now 6 minutes :classic_blink:

    (it was around 1 minute before with 11.2... and 50 seconds with 10.x)

     

    For the test, I do a "Clean" and then a "Build"

     

    Do you experiment the same ?

     

     

    PS : other problem : the inspection of the code with "CTRL" and "selection" do not almost never gets you to the definition.  I use now the good old "search", as in a Notepad.

    It was the case allready with 11.x, but now it becomes worse

     


  2. 19 hours ago, Remy Lebeau said:

    Just a small nitpick - you can change this:

    
    RE.SelStart  := Perform(EM_LINEINDEX, myLineIndex, 0);
    RE.SelLength := length(Lines[myLineIndex]);

    To this instead:

    
    var myLineStart: Integer;
    myLineStart := Perform(EM_LINEINDEX, myLineIndex, 0); 
    RE.SelStart := myLineStart;
    RE.SelLength := Perform(EM_LINELENGTH, myLineStart, 0);

    That will avoid a memory allocation trying to retrieve the actual String of the line in question.  The RichEdit already knows how many characters are on the line without needing to access the actual characters.

     

    An then to can be optimized further by using EM_EXSETSEL directly instead of the SelStart/Length properties:

    
    var rng: CHARRANGE;
    rng.cpMin := Perform(EM_LINEINDEX, myLineIndex, 0);
    rng.cpMax := rng.cpMin + Perform(EM_LINELENGTH, rng.cpMin, 0);
    Perform(EM_EXSETSEL, 0, LParam(@rng));

    Further speed optimizations can be accomplished using EM_SETCHARFORMAT/2 and EM_SETEVENTMASK messages, see Faster Rich Edit Syntax Highlighting for details.

    Thanks for this new optimisations

    Denis


  3. Hello,

    My colleague found a turnaround (without using the problematic SetText procedure)

     

    0- As before, we add the lines with 'Courier New' and special characters. 

    Result is ugly as shown before.

    But for each line of the memo, we store the font color and the size (in a memory object ALineSpecial).

     

    1- At the end of the addings I place : RE.font.Name := 'Courier New';

    All the text is now well aligned, but we lost the colors and the size.

     

    2- I parse all the lines, and when needed, set the color and the size of the concerned line :

       myLineIndex := ALineSpecial.getInt1(i);                                 // get the index of the line

       RE.SelStart  := Perform(EM_LINEINDEX, myLineIndex, 0);       // set start position of the selection
       RE.SelLength := length(Lines[myLineIndex]);                          // set lenght of the selection (the line)
       myColor := TColor(ALineSpecial.getO(i));                               // get the color to apply (it comes from the memory object)
       RE.SelAttributes.Color := myColor;                                        // apply the color to the selection

     

    And the result is OK

     

    image.thumb.png.096ab48453e39efe64526c181d76dfcf.png

     

    Many thanks for your contributions,

    Denis

    • Thanks 1

  4. 4 hours ago, PeterBelow said:

    Thanks for this links,

    but it do not adress the TRichEdit.SelText problematic, which transforms the "Courier New" font, when some special characters are given to SelText (ex : ═  alt 205 et ─ alt 196...)

    Denis


  5. 19 hours ago, rvk said:

    Have you tried this in BBInitClick

    
    RE.DefAttributes.name := 'Courier New';
    RE.DefAttributes.size := 8;

    And alternatively this in add()

    
    RE.SelAttributes.name := 'Courier New';
    RE.SelAttributes.size := 8;
    RE.SelText := myText;

     

    Sometimes SelAttributes are not hold after you have set SelText.


     

    We had exactly the same lines in our program :

    image.png.3b6da860abb6c72c89b2c1182672c4fe.png

     

    And the proposition with "DefAttributes" do not work either.


  6. Hello,

    We just installed the Delphi 11.1.

    But there is a problem with the TRichEdit.

    When we add a line including formatting characters as "alt 205" or "alt179" or "alt196", with the "Courier New" font, then the police changes to an other police (Segoe UI Symbol) and the result is ugly.

    We uses the following instruction for adding this line : myRichEdit.SelText := myString.

    This way of reporting was used for years without problem in many places of our application.

    Is it a documented bug, are there any turnarounds ?

    Any help would be appreciated,

    Denis Dresse

     

    image.thumb.png.f0ab2cb35ea0b4b732eeeff44b2fc602.png

     

×