EditButton: Make the container always have the same color as the Parent.

git-svn-id: trunk@44813 -
This commit is contained in:
bart 2014-04-26 15:12:57 +00:00
parent 36d8715662
commit 91148720b3

View File

@ -106,6 +106,7 @@ type
function GetModified: Boolean;
function GetNumbersOnly: Boolean;
function GetNumGlyps: Integer;
function GetParentColor: Boolean;
function GetPasswordChar: char;
function GetReadOnly: Boolean;
function GetSelLength: Integer;
@ -159,6 +160,7 @@ type
procedure SetModified(AValue: Boolean);
procedure SetNumbersOnly(AValue: Boolean);
procedure SetNumGlyphs(AValue: Integer);
procedure SetParentColor(AValue: Boolean);
procedure SetPasswordChar(AValue: char);
procedure SetPopupMenu(AValue: TPopupMenu);
procedure SetReadOnly(AValue: Boolean);
@ -206,6 +208,7 @@ type
procedure CheckCursor;
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
function EditCanModify: Boolean; virtual;
procedure GetSel(out _SelStart: Integer; out _SelStop: Integer);
procedure SetSel(const _SelStart: Integer; _SelStop: Integer);
@ -253,7 +256,7 @@ type
property CanUndo: Boolean read GetCanUndo;
property CaretPos: TPoint read GetCaretPos write SetCaretPos;
property CharCase: TEditCharCase read GetCharCase write SetCharCase default ecNormal;
property ParentColor default False;
property ParentColor: Boolean read GetParentColor write SetParentColor default False;
property EchoMode: TEchoMode read GetEchoMode write SetEchoMode default emNormal;
property HideSelection: Boolean read GetHideSelection write SetHideSelection default False;
property MaxLength: Integer read GetMaxLength write SetMaxLength;
@ -1218,6 +1221,11 @@ begin
Result := FButton.NumGlyphs;
end;
function TCustomEditButton.GetParentColor: Boolean;
begin
Result := FEdit.ParentColor;
end;
function TCustomEditButton.GetPasswordChar: char;
begin
Result := FEdit.PasswordChar;
@ -1344,6 +1352,11 @@ begin
FButton.NumGlyphs := AValue;
end;
procedure TCustomEditButton.SetParentColor(AValue: Boolean);
begin
FEdit.ParentColor := AValue;
end;
procedure TCustomEditButton.SetPasswordChar(AValue: char);
begin
FEdit.PasswordChar := AValue;
@ -1488,6 +1501,15 @@ begin
FEdit.CheckCursor;
end;
procedure TCustomEditButton.CMParentColorChanged(var Message: TLMessage);
begin
if inherited ParentColor then
begin
inherited SetColor(Parent.Color);
inherited ParentColor := True;
end;
end;
function TCustomEditButton.EditCanModify: Boolean;
begin
Result := FEdit.EditCanModify;
@ -1514,6 +1536,7 @@ begin
CheckButtonVisible;
end;
procedure TCustomEditButton.Reset;
begin
FEdit.Reset;
@ -1561,7 +1584,7 @@ begin
FEdit := TEbEdit.Create(Self);
inherited Create(AOwner);
ControlStyle := ControlStyle + [csNoFocus];
ParentColor := False;
FEdit.ParentColor := False;
FInitialColor := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
BorderStyle := bsNone;
FButtonAlign := BaRight;
@ -1619,6 +1642,7 @@ begin
end;
AutoSize := True;
Color := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
inherited ParentColor := True; //don't want to see the container if Parent's color changes
end;
destructor TCustomEditButton.Destroy;