Skip to content

Commit

Permalink
* Extracted procedure that controls the initial selection of the edit…
Browse files Browse the repository at this point in the history
… field. This should allow deriving classes to adjust this behavior more easily.
  • Loading branch information
Daniel-Tr committed Feb 1, 2024
1 parent ca28e53 commit 3b1cde1
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Source/VirtualTrees.EditLink.pas
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ TStringEditLink = class(TWinControlEditLink)
FTextBounds : TRect; //Smallest rectangle around the text.
function GetEdit: TVTEdit; //Getter for the FEdit member;
procedure SetEdit(const Value : TVTEdit); //Setter for the FEdit member;

procedure InitializeSelection; virtual;
public
constructor Create;

Expand Down Expand Up @@ -740,6 +742,13 @@ function TStringEditLink.GetEdit: TVTEdit;

//----------------------------------------------------------------------------------------------------------------------

procedure TStringEditLink.InitializeSelection;
begin
Edit.SelectAll;
end;

//----------------------------------------------------------------------------------------------------------------------

procedure TStringEditLink.SetEdit(const Value : TVTEdit);
begin
inherited SetEdit(Value);
Expand All @@ -752,7 +761,7 @@ function TStringEditLink.BeginEdit : Boolean;
Result := inherited;
if Result then
begin
Edit.SelectAll;
InitializeSelection;
Edit.AutoAdjustSize;
end;
end;
Expand Down

0 comments on commit 3b1cde1

Please sign in to comment.