just need o access to my custom TreeView with this:
MyTreeView1.Selected.MyOwnProperty := 'something';
So, all i want to do is make same component as TreeView is but + i need to add my own property to all of the TreeNodes of TreeView.
If I may ask again, can anybody explain me how to use "data property of TTreeNodes to point to an object"? Could anybody explain how to save some information to it (for example name and age) and how to get this information from selected TTreeNode?
At least with XE, you can override the creation of tree nodes with a TTreeView using the OnCreateNodeClass property to create custom TTreeNodes.
For example:
type
TMyTreeNode = class (TTreeNode)
//
end;
procedure TMyForm.OnCreate(Sender: TObject);
begin
MyTreeView.OnCreateNodeClass := OnCreateNodeClass;
end;
procedure TMyForm.OnCreateNodeClass(Sender: TCustomTreeView;
var NodeClass: TTreeNodeClass);
begin
NodeClass := TMyTreeNode;
end;
You can then subclass TTreeView to change Selected to return your tree node class.