mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-14 19:19:18 +02:00
LCL: Reset TBitBtn.Caption when DefaultCaption=True. Issue #37472, patch from Joeny Ang.
git-svn-id: trunk@63692 -
This commit is contained in:
parent
777d2f64a4
commit
909fb619f4
@ -174,6 +174,7 @@ type
|
||||
procedure SetNumGlyphs(AValue: Integer);
|
||||
procedure SetSpacing(AValue: Integer);
|
||||
procedure RealizeKind(ForceDefaults: Boolean);
|
||||
procedure SetDefaultCaption(const AValue: Boolean);
|
||||
//Return the caption associated with the aKind value.
|
||||
function GetCaptionOfKind(AKind: TBitBtnKind): String;
|
||||
function GetImages: TCustomImageList;
|
||||
@ -205,7 +206,7 @@ type
|
||||
function CanShowGlyph(const AWithShowMode: Boolean = False): Boolean;
|
||||
public
|
||||
property Caption stored IsCaptionStored;
|
||||
property DefaultCaption: Boolean read FDefaultCaption write FDefaultCaption default False;
|
||||
property DefaultCaption: Boolean read FDefaultCaption write SetDefaultCaption default False;
|
||||
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsGlyphStored;
|
||||
property NumGlyphs: Integer read GetNumGlyphs write SetNumGlyphs default 1;
|
||||
property Images: TCustomImageList read GetImages write SetImages;
|
||||
|
@ -230,7 +230,7 @@ begin
|
||||
if (FKind <> bkCustom) and not (csLoading in ComponentState) then
|
||||
RealizeKind(True);
|
||||
if not (csLoading in ComponentState) then
|
||||
DefaultCaption := FKind <> bkCustom;
|
||||
FDefaultCaption := FKind <> bkCustom;
|
||||
end;
|
||||
|
||||
procedure TCustomBitBtn.SetLayout(AValue: TButtonLayout);
|
||||
@ -348,6 +348,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCustomBitBtn.SetDefaultCaption(const AValue: Boolean);
|
||||
begin
|
||||
if FDefaultCaption = AValue then Exit;
|
||||
FDefaultCaption := AValue;
|
||||
if (Kind <> bkCustom) and DefaultCaption then
|
||||
begin
|
||||
Caption := GetCaptionOfKind(FKind); // will trigger TextChanged
|
||||
FDefaultCaption := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ Return the caption associated with the akind value.
|
||||
This function replaces BitBtnCaption const because the localizing
|
||||
do not work with an const array }
|
||||
@ -386,7 +397,7 @@ begin
|
||||
if (Kind <> bkCustom) and DefaultCaption and (Caption = '') then
|
||||
begin
|
||||
Caption := GetCaptionOfKind(Kind); // Will trigger TextChanged
|
||||
DefaultCaption := True;
|
||||
FDefaultCaption := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -394,7 +405,7 @@ procedure TCustomBitBtn.TextChanged;
|
||||
begin
|
||||
inherited TextChanged;
|
||||
AdjustSize;
|
||||
DefaultCaption := False;
|
||||
FDefaultCaption := False;
|
||||
end;
|
||||
|
||||
class function TCustomBitBtn.GetControlClassDefaultSize: TSize;
|
||||
|
Loading…
Reference in New Issue
Block a user