Delphi 11.3 TTMSFMXEdit issue + workaround

Hello,

I know there was an issue with the TTMSFMXEdit in combination with Delphi 11.3.
A fix was made and it seems to work fine.

I believe the "fix" was a Exit right at the beginning in the method TTMSFMXCustomEditEx.RealignButtonsContainer.
However we add buttons to our Edits and they are displayed completely at wrong place and wrong size.

The issue is that the method keeps calling itself without the Exit and generates a stackoverflow.

However for us the fix was not the best solution.
It fixed it at our side (for now), hopefully you can implement this also at your side, because maybe others will have the same problem as we do.

My solution is as follows:

  • Remove the Exit in TTMSFMXCustomEditEx.RealignButtonsContainer
  • Define a new field/member called FInRealign : Boolean;
  • In the Create method, initialize FInRealign (FInRealign := False;)
  • Change the method TTMSFMXCustomEditEx.DoRealign as below
procedure TTMSFMXCustomEditEx.DoRealign;
begin
  if FInRealign then
    Exit;

  FInRealign := True;
  try
    RealignContent;
    inherited DoRealign;
    RealignButtonsContainer;
    CaretPosition := GetOriginCaretPosition;
  finally
    FInRealign := False;
  end;
end;

Thanks for the feedback. We have updated the code accordingly.