Browse Source

Fix of text change in bcimagebutton.pas

lainz 9 years ago
parent
commit
f6dcb8e92b
1 changed files with 11 additions and 0 deletions
  1. 11 0
      bcimagebutton.pas

+ 11 - 0
bcimagebutton.pas

@@ -251,6 +251,7 @@ type
     { Protected declarations }
     { Protected declarations }
     procedure DrawControl; override;
     procedure DrawControl; override;
     procedure RenderControl; override;
     procedure RenderControl; override;
+    procedure TextChanged; override;
     procedure CMChanged(var Message: TLMessage); message CM_CHANGED; virtual;
     procedure CMChanged(var Message: TLMessage); message CM_CHANGED; virtual;
     {$IFDEF DEBUG}
     {$IFDEF DEBUG}
     function GetDebugText: string;
     function GetDebugText: string;
@@ -1072,6 +1073,16 @@ begin
   {$ENDIF}
   {$ENDIF}
 end;
 end;
 
 
+procedure TBCCustomImageButton.TextChanged;
+begin
+  InvalidatePreferredSize;
+  if Assigned(Parent) and Parent.AutoSize then
+    Parent.AdjustSize;
+  AdjustSize;
+  RenderControl;
+  Invalidate;
+end;
+
 procedure TBCCustomImageButton.CMChanged(var Message: TLMessage);
 procedure TBCCustomImageButton.CMChanged(var Message: TLMessage);
 begin
 begin
   if csReadingState in ControlState then
   if csReadingState in ControlState then