mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 21:59:16 +02:00
EditButton: Make the container always have the same color as the Parent.
git-svn-id: trunk@44813 -
This commit is contained in:
parent
36d8715662
commit
91148720b3
@ -106,6 +106,7 @@ type
|
|||||||
function GetModified: Boolean;
|
function GetModified: Boolean;
|
||||||
function GetNumbersOnly: Boolean;
|
function GetNumbersOnly: Boolean;
|
||||||
function GetNumGlyps: Integer;
|
function GetNumGlyps: Integer;
|
||||||
|
function GetParentColor: Boolean;
|
||||||
function GetPasswordChar: char;
|
function GetPasswordChar: char;
|
||||||
function GetReadOnly: Boolean;
|
function GetReadOnly: Boolean;
|
||||||
function GetSelLength: Integer;
|
function GetSelLength: Integer;
|
||||||
@ -159,6 +160,7 @@ type
|
|||||||
procedure SetModified(AValue: Boolean);
|
procedure SetModified(AValue: Boolean);
|
||||||
procedure SetNumbersOnly(AValue: Boolean);
|
procedure SetNumbersOnly(AValue: Boolean);
|
||||||
procedure SetNumGlyphs(AValue: Integer);
|
procedure SetNumGlyphs(AValue: Integer);
|
||||||
|
procedure SetParentColor(AValue: Boolean);
|
||||||
procedure SetPasswordChar(AValue: char);
|
procedure SetPasswordChar(AValue: char);
|
||||||
procedure SetPopupMenu(AValue: TPopupMenu);
|
procedure SetPopupMenu(AValue: TPopupMenu);
|
||||||
procedure SetReadOnly(AValue: Boolean);
|
procedure SetReadOnly(AValue: Boolean);
|
||||||
@ -206,6 +208,7 @@ type
|
|||||||
|
|
||||||
|
|
||||||
procedure CheckCursor;
|
procedure CheckCursor;
|
||||||
|
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
|
||||||
function EditCanModify: Boolean; virtual;
|
function EditCanModify: Boolean; virtual;
|
||||||
procedure GetSel(out _SelStart: Integer; out _SelStop: Integer);
|
procedure GetSel(out _SelStart: Integer; out _SelStop: Integer);
|
||||||
procedure SetSel(const _SelStart: Integer; _SelStop: Integer);
|
procedure SetSel(const _SelStart: Integer; _SelStop: Integer);
|
||||||
@ -253,7 +256,7 @@ type
|
|||||||
property CanUndo: Boolean read GetCanUndo;
|
property CanUndo: Boolean read GetCanUndo;
|
||||||
property CaretPos: TPoint read GetCaretPos write SetCaretPos;
|
property CaretPos: TPoint read GetCaretPos write SetCaretPos;
|
||||||
property CharCase: TEditCharCase read GetCharCase write SetCharCase default ecNormal;
|
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 EchoMode: TEchoMode read GetEchoMode write SetEchoMode default emNormal;
|
||||||
property HideSelection: Boolean read GetHideSelection write SetHideSelection default False;
|
property HideSelection: Boolean read GetHideSelection write SetHideSelection default False;
|
||||||
property MaxLength: Integer read GetMaxLength write SetMaxLength;
|
property MaxLength: Integer read GetMaxLength write SetMaxLength;
|
||||||
@ -1218,6 +1221,11 @@ begin
|
|||||||
Result := FButton.NumGlyphs;
|
Result := FButton.NumGlyphs;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomEditButton.GetParentColor: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FEdit.ParentColor;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomEditButton.GetPasswordChar: char;
|
function TCustomEditButton.GetPasswordChar: char;
|
||||||
begin
|
begin
|
||||||
Result := FEdit.PasswordChar;
|
Result := FEdit.PasswordChar;
|
||||||
@ -1344,6 +1352,11 @@ begin
|
|||||||
FButton.NumGlyphs := AValue;
|
FButton.NumGlyphs := AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomEditButton.SetParentColor(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
FEdit.ParentColor := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomEditButton.SetPasswordChar(AValue: char);
|
procedure TCustomEditButton.SetPasswordChar(AValue: char);
|
||||||
begin
|
begin
|
||||||
FEdit.PasswordChar := AValue;
|
FEdit.PasswordChar := AValue;
|
||||||
@ -1488,6 +1501,15 @@ begin
|
|||||||
FEdit.CheckCursor;
|
FEdit.CheckCursor;
|
||||||
end;
|
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;
|
function TCustomEditButton.EditCanModify: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := FEdit.EditCanModify;
|
Result := FEdit.EditCanModify;
|
||||||
@ -1514,6 +1536,7 @@ begin
|
|||||||
CheckButtonVisible;
|
CheckButtonVisible;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCustomEditButton.Reset;
|
procedure TCustomEditButton.Reset;
|
||||||
begin
|
begin
|
||||||
FEdit.Reset;
|
FEdit.Reset;
|
||||||
@ -1561,7 +1584,7 @@ begin
|
|||||||
FEdit := TEbEdit.Create(Self);
|
FEdit := TEbEdit.Create(Self);
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
ControlStyle := ControlStyle + [csNoFocus];
|
ControlStyle := ControlStyle + [csNoFocus];
|
||||||
ParentColor := False;
|
FEdit.ParentColor := False;
|
||||||
FInitialColor := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
|
FInitialColor := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
|
||||||
BorderStyle := bsNone;
|
BorderStyle := bsNone;
|
||||||
FButtonAlign := BaRight;
|
FButtonAlign := BaRight;
|
||||||
@ -1619,6 +1642,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
AutoSize := True;
|
AutoSize := True;
|
||||||
Color := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
|
Color := {$ifdef UseCLDefault}clDefault{$else}clWindow{$endif};
|
||||||
|
inherited ParentColor := True; //don't want to see the container if Parent's color changes
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TCustomEditButton.Destroy;
|
destructor TCustomEditButton.Destroy;
|
||||||
|
Loading…
Reference in New Issue
Block a user