Skip to content

Commit 3b1cde1

Browse files
committed
* Extracted procedure that controls the initial selection of the edit field. This should allow deriving classes to adjust this behavior more easily.
1 parent ca28e53 commit 3b1cde1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Source/VirtualTrees.EditLink.pas

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ TStringEditLink = class(TWinControlEditLink)
148148
FTextBounds : TRect; //Smallest rectangle around the text.
149149
function GetEdit: TVTEdit; //Getter for the FEdit member;
150150
procedure SetEdit(const Value : TVTEdit); //Setter for the FEdit member;
151+
152+
procedure InitializeSelection; virtual;
151153
public
152154
constructor Create;
153155

@@ -740,6 +742,13 @@ function TStringEditLink.GetEdit: TVTEdit;
740742

741743
//----------------------------------------------------------------------------------------------------------------------
742744

745+
procedure TStringEditLink.InitializeSelection;
746+
begin
747+
Edit.SelectAll;
748+
end;
749+
750+
//----------------------------------------------------------------------------------------------------------------------
751+
743752
procedure TStringEditLink.SetEdit(const Value : TVTEdit);
744753
begin
745754
inherited SetEdit(Value);
@@ -752,7 +761,7 @@ function TStringEditLink.BeginEdit : Boolean;
752761
Result := inherited;
753762
if Result then
754763
begin
755-
Edit.SelectAll;
764+
InitializeSelection;
756765
Edit.AutoAdjustSize;
757766
end;
758767
end;

0 commit comments

Comments
 (0)