To
skalogryz:
I've installed r4013 today and made some tests.
- Using
GetTextAttributes now works correctly, with no background color problems.
- Using
SetTextAttributes with
TFont variable still does not work as expected. The code is something like this:
f:=TFont.Create;
...
f.Assign(RichMemo1.Font);
f.Color:=clBlue;
f.Style:=[fsItalic];
with RichMemo1 do
SetTextAttributes(SelStart,SelLength,f);
...
f.Free;
Now the selected text does not "disappear" (size is not set to 0), which is fine, but neither color, nor style are set as required - they are set to default instead.
Examining the run-time values it seems there are actually two problems:
--
f.Assign(RichMemo1.Font) does not set the
f variable correctly - e.g. the size is still set to 0.
-- When
SetTextAttributes method is called with
f as
TFont parameter, it uses
GetFontParams function to convert
TFont variable to
TFontParams structure. This function appears to correct some damage caused by the former error ("repairs" the font name and size), but for some reason, does not set the color and style correctly...
I've also made tests with
RichMemoUtils. As they use
GetTextAttributes method, they were affected by the "background color error" as well, but in the new release they work ok.
Thanks for your support. I hope I haven't made some silly mistake during the above tests...