TBitBtn now calls AdjustSize on change

git-svn-id: trunk@7748 -
This commit is contained in:
mattias 2005-09-19 22:07:12 +00:00
parent f2b6a4f242
commit aac6d79b71
10 changed files with 25 additions and 9 deletions

View File

@ -198,6 +198,7 @@ type
procedure Click; override;
procedure GlyphChanged(Sender: TObject);
procedure InitializeWnd; override;
procedure TextChanged; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; Override;

View File

@ -967,6 +967,7 @@ type
function GetAction: TBasicAction; virtual;
function RealGetText: TCaption; virtual;
procedure RealSetText(const Value: TCaption); virtual;
procedure TextChanged; virtual;
function GetCachedText(var CachedText: TCaption): boolean; virtual;
procedure SetAction(Value: TBasicAction); virtual;
procedure SetColor(Value: TColor); virtual;

View File

@ -76,6 +76,7 @@ end;
Procedure TCustomBitBtn.SetGlyph(AValue: TBitmap);
Begin
FButtonGlyph.Glyph := AValue;
AdjustSize;
end;
procedure TCustomBitBtn.GlyphChanged(Sender: TObject);
@ -127,6 +128,7 @@ Begin
FLayout := AValue;
if HandleAllocated
then TWSBitBtnClass(WidgetSetClass).SetLayout(Self, FLayout);
AdjustSize;
end;
procedure TCustomBitBtn.SetMargin(const AValue: integer);
@ -135,6 +137,7 @@ begin
FMargin := AValue;
if HandleAllocated
then TWSBitBtnClass(WidgetSetClass).SetMargin(Self, FMargin);
AdjustSize;
end;
procedure TCustomBitBtn.SetNumGlyphs(AValue: Integer);
@ -147,7 +150,6 @@ begin
FButtonGlyph.NumGlyphs := TNumGlyphs(AValue);
Invalidate;
end;
end;
Procedure TCustomBitBtn.SetSpacing(AValue: Integer);
@ -156,6 +158,7 @@ Begin
FSpacing := AValue;
if HandleAllocated
then TWSBitBtnClass(WidgetSetClass).SetSpacing(Self, FSpacing);
AdjustSize;
end;
procedure TCustomBitBtn.RealizeKind;
@ -210,5 +213,11 @@ begin
TWSBitBtnClass(WidgetSetClass).SetSpacing(Self, FSpacing);
end;
procedure TCustomBitBtn.TextChanged;
begin
inherited TextChanged;
AdjustSize;
end;
// included by buttons.pp

View File

@ -3176,6 +3176,11 @@ procedure TControl.RealSetText(const Value: TCaption);
begin
if FCaption = Value then Exit;
FCaption := Value;
TextChanged;
end;
procedure TControl.TextChanged;
begin
Perform(CM_TEXTCHANGED, 0, 0);
end;

View File

@ -348,7 +348,7 @@ end;
Params: Value to set FModified to
Returns: Nothing
------------------------------------------------------------------------------}
Procedure TCustomEdit.CMTextChanged(var Message : TLMessage);
Procedure TCustomEdit.TextChanged;
var
Temp : String;
Begin

View File

@ -124,7 +124,7 @@ begin
end;
end;
procedure TCustomLabel.CMTextChanged(var Message: TLMSetText);
procedure TCustomLabel.TextChanged;
begin
Invalidate;
AdjustSize;

View File

@ -36,7 +36,7 @@ begin
Result:=true; // fpc bug, default value is always 0
end;
procedure TCustomSpinEdit.CMTextChanged(var Message: TLMessage);
procedure TCustomSpinEdit.TextChanged;
begin
if Value=fLastValueOnChange then exit;
fLastValueOnChange:=Value;

View File

@ -105,7 +105,7 @@ type
procedure CursorInc(CursorPos: Integer; Incr: Integer);
procedure CursorDec(CursorPos: Integer);
procedure ArrowKeys(CharCode: Word; Shift: TShiftState);
procedure CMTextChanged(var Message: TLMessage); message CM_TEXTCHANGED;
procedure TextChanged; override;
protected
procedure ReformatText(const NewMask: string);
procedure SetCursor(Pos: Integer);
@ -1080,7 +1080,7 @@ begin
end;
end;
procedure TCustomMaskEdit.CMTextChanged(var Message: TLMessage);
procedure TCustomMaskEdit.TextChanged;
var
Temp: Integer;
begin

View File

@ -66,7 +66,7 @@ type
Procedure UpdateControl;
function ValueIsStored: boolean;
protected
procedure CMTextChanged(Var Message: TLMessage); message CM_TextChanged;
procedure TextChanged; override;
procedure SetDecimals(Num: Integer);
Function GetValue: Single;
procedure SetValue(const Num: Single);

View File

@ -593,7 +593,7 @@ type
protected
procedure CalculatePreferredSize(var PreferredWidth, PreferredHeight: integer); override;
procedure CreateWnd; override;
procedure CMTextChanged(Var Message: TLMessage); message CM_TextChanged;
procedure TextChanged; override;
procedure Change; dynamic;
function GetSelLength: integer; virtual;
function GetSelStart: integer; virtual;
@ -1132,7 +1132,7 @@ type
procedure CalcSize(var AWidth, AHeight: integer);
procedure DoAutoSize; override;
function DialogChar(var Message: TLMKey): boolean; override;
procedure CMTextChanged(var Message: TLMSetText); message CM_TEXTCHANGED;
procedure TextChanged; override;
procedure Resize; override;
procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE;