Page 1 of 1
Prevent nodes from getting selected
Posted: Sat Nov 14, 2015 3:48 pm
by 10546756
Hello!
I TTree, how do I prevent all nodes from getting selected?
Best regards, Mikael
Re: Prevent nodes from getting selected
Posted: Mon Nov 16, 2015 12:22 pm
by yeray
Hello,
Lenfors wrote:I TTree, how do I prevent all nodes from getting selected?
If you only want the nodes not to look as selected, you can just change the color of the selected shapes and font:
Code: Select all
Tree1.Selected.Color:=clNone;
Tree1.Selected.TextColor:=clBlack;
If you don't want to have any shape in the Tree1.Selected list, you can clear it at OnClick event:
Code: Select all
procedure TForm1.Tree1Click(Sender: TObject);
begin
Tree1.Selected.Clear;
end;
Or at OnMouseDown:
Code: Select all
procedure TForm1.Tree1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
Tree1.Selected.Clear;
end;