Hi, is there a way to get the font of cpword?
To give you an idea of why I want this, I have implemented an Auto Complete function using AfterCompleteWordEvent. This allows users to type abbreviations and have them replaced by words or phrases. However, I'm also allowing users to insert a special symbol (using a custom-designed font) and I want to be able to exclude these symbols so that they don't trigger AfterCompleteWordEvent if a space is typed after a symbol is inserted.
This is what I tried:
TWPRichText(Sender).WritingAttr.GetFontName(mfnFontName);
if CompareText(mfnFontName, SYMBOL_FONT_NAME) = 0 then
exit;
ReplacementWord := GetReplacementForWord(TWPRichText(Sender).CPWord);
if ReplacementWord <> '***NONE FOUND***' then
begin
TWPRichText(Sender).CPWord := ReplacementWord;
TWPRichText(Sender).ReformatAll(false,true);
end;
Alles anzeigen
This doesn't work, because after inserting a symbol, I change the font back to the original font (for instance Arial) so that a symbol can be inserted and then the user can continue typing. So by the time the AfterCompleteWordEvent is triggered, I can't check the current font to see if a symbol has been entered.
Hence my original question - is there some way to get the font of cpword, or the previous word?