Gerrit Beuze
Gerrit Beuze

Reputation: 921

Windows Richedit shows spelling correction suggestions on wrong monitor

I'm using a TRichEdit subclass in a Windows application built with Delphi 10.3. The RichEdit uses class name 'RICHEDIT50W'. In this richedit control I have enabled spelling and auto correction like so:

var
  Value: LRESULT;
const
  IMF_TKBAUTOCORRECTION = $2000;
begin
  Value := SendMessage(Handle, EM_GETLANGOPTIONS, 0, 0);
  if (FAutoCorrection) then
    Value := Value or IMF_TKBAUTOCORRECTION
  else
    Value := Value and not IMF_TKBAUTOCORRECTION;
  SendMessage(Handle, EM_SETLANGOPTIONS, 0, Value);
end;

var
  Value: LRESULT;
const
  IMF_SPELLCHECKING = $0800;
begin
  Value := SendMessage(Handle, EM_GETLANGOPTIONS, 0, 0);
  if (FSpellChecking) then
    Value := Value or IMF_SPELLCHECKING
  else
    Value := Value and not IMF_SPELLCHECKING;
  SendMessage(Handle, EM_SETLANGOPTIONS, 0, Value);
end;

This works fine except when using a second monitor, in that case the spelling correction suggestions popup on the wrong second monitor.

Any idea what is causing this and how to fix it?

Upvotes: 0

Views: 164

Answers (0)

Related Questions