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