Browse Source

Prevent premature handle allocation and consecutive calculations with wrong font scaling

(manifested by failed assertion in ScaleByTextHeight)

Source commit: a4c2c15e41e32e948320b3009190d4ba14fe8964
Martin Prikryl 4 months ago
parent
commit
8147b809af
1 changed files with 2 additions and 2 deletions
  1. 2 2
      source/packages/my/ComboEdit.pas

+ 2 - 2
source/packages/my/ComboEdit.pas

@@ -467,7 +467,7 @@ begin
       with FButton do
         ControlStyle := ControlStyle - [csFixedWidth];
     end
-    else if (Value <> ButtonWidth) and (Value < ClientWidth) then
+    else if (Value <> ButtonWidth) then
     begin
       FButton.Width := Value;
       with FButton do
@@ -542,7 +542,7 @@ begin
   with BtnRect do
     FBtnControl.SetBounds(Left, Top, Right - Left, Bottom - Top);
   FButton.Height := FBtnControl.Height;
-  SetEditRect;
+  if HandleAllocated then SetEditRect;
 end;
 
 procedure TCustomComboEdit.CMCtl3DChanged(var Message: TMessage);