Richedit and stretched

Hi,

Something is wrong with Richedit and stretched. Sometimes it is not working.

I am generating my report at runtime. I am using Richedit with variables included (like '[date]'). I have master - datail - subdetail report. Richedit is in subdetail band. It is like few times richedit is not stretched, and then it is stretched once.

With Fr 251 I was able to reproduce it using "Reports" demo. With Fr 252 I am trying, still without success. But anyway, richedit in my application/reports is not working.

I will try to find the problem. And I will try to provide sample report where richedit stretched is not working.

At this time my questions are:
1. Could you give me some advice, directions?
2. What is different in Fr 252 about "richedit" or "stretched"?
3. shall it be useful if I provide Fr251 sample project where this problem is visible?

And another question. In FR_Rich.pas we have:
Line 263...
...
      repeat
        chrg.cpMin := LastChar;
        LastChar := SRichEdit.Perform(EM_FORMATRANGE, 0, Integer(@Range));
        Fit := (LastChar >= MaxLen) or (LastChar = -1) or (LastChar = 0);

        // Paco
        HighDy := Round((Range.rc.Bottom - Range.rc.Top) / (1440.0 / LogY));
        Break;

        StopRender := ((LastChar < MaxLen) and (LastChar <> -1)) or Fit;
      until StopRender;

      // Paco
      Break;

      if Fit then
        HighDy := NewDY else
        LowDy := NewDY;
...

When I said sometimes it is not working, sometimes it is, I mean return value of function "DoCalcHeight" is
10 - incorrect
10 - incorrect
10 - incorrect
76 - correct
etc...

Instead I did something like this:
...
        SRichEdit.Perform(EM_FORMATRANGE, 0, Integer(@Range));
        HighDy := Round((Range.rc.Bottom - Range.rc.Top) / (1440.0 / LogY));
...

Because I do not know very well your engine, my question is about the right solution. Could you tell me what could be wrong with my solution? I mean, why your solution is different? Could you advice me how to do it in such way so it will work in any case?

Thanks for your attention, your time and help.

regards,
Plamen.

Comments

  • edited 7:59PM
    Your solution is used in the TfrRxRichView object. This procedure is different for RTF1.0 and RTF2.0.
  • edited 7:59PM
    Thanks. I use some very simple Richedit features. This is why I decide to use standard Richedit considering final EXE file size. But I try with RxRichEdit and it is ok.

    I was looking for any mistake with my code and runtime generated report. Finally I create simple application/report and I understand the problem, very simple. If you have standard Richedit with text like this for example:
    wrote:
    TEST test test test

    Just one line text. Whole text have to fit in one line.
    If your font height is 40 pixels then set Richedit height to 20 (for example).
    In this way Richedit will not be stretched.

    Anyway, I will do it with RxRichedit (prefer to not modify FR source code if possible)

    All best and thanks again.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.