I have a TRichEdit control on my Delphi form, and I'm assigning a background colour to certain parts of the text using the perform method to send a windows message to the control. (Text is selected using SelStart and SelLength before calling this code).
FillChar(Format, SizeOf(Format), 0);
with Format do
begin
cbSize := SizeOf(Format);
dwMask := CFM_BACKCOLOR;
crBackColor := AColor;
fRichEdit.Perform(EM_SETCHARFORMAT, SCF_SELECTION, Longint(@Format));
end;
I'm also wanting the font to be changeable by the user (the ENTIRE font, it's not selective like the background highlighting), so I'm presenting a TFontDialog to the user when they'd like to modify the font for the edit box, and I'm assigning the font to the font of the TRichEdit control.
RichEdit.Font.Assign(SelectedFont);
However, using a windows message seems to stop the font from updating. When I comment out the perform method, everything works fine, but when I uncomment the line, the font doesn't update.
I'm new to windows messages, please explain why this is happening.