Its easy to set the node to edit from code
I create the node and make it go directly into edit mode
but when running my program the TreeView node is totally in the wrong place when editing.
I do a TreeView.repaint; in the same procedure to move the node to the correct place in TreeView but its still in the incorrect place
Is their a TreeView event I should use to get the correct alignment some how?
to me its silly - frustrating stuff
Can you show the code you are using to position the node?
That is it I cannot find anything to position the node
its suppose to position it self
procedure TForm1.Addkey1Click(Sender: TObject); Var TN1: TTreeNode; Key: TKeyList; begin If TV.Selected <> nil then begin Key := TKeyList.Create('New Key - ReName', TKeyList(TV.Selected.Data)); TN1 := TV.Items.AddChildObject(TV.Selected, 'New Key - ReName', Key); TN1.Selected := True; TN1.EditText; end; end;
procedure TForm1.TVEdited(Sender: TObject; Node: TTreeNode; var S: string);
Var
S1: String;
I: Integer;
Key: TKeyList;
NodeP, TN: TTreeNode;
begin
If Node.Parent <> nil then
begin
NodeP := Node.Parent;
For I := 1 to Length(S) - 1
do If S[I] In[‘/’,‘',’~']
then S := ‘Invalid key Name’;
Key := TKeyList(Node.Data);
S1 := Key.KeyName;
end;
If S[Length(S)] <> '/' then S := S + '/';
NodeP := Node.Parent;
If TKeyList(Node.Data) is TKeyList then
begin
TKeyList(NodeP.Data).KeyName := S;
S := Copy(S, 1, length(S) -1);
end else
begin
If NodeP = nil then Exit;
Node.Free;
Key := TKeyList.Create(S1 + S, TKeyList(NodeP.Data));
S := Copy(S, 1, length(S) -1);
TN := TV.Items.AddChildObject(NodeP, S, Key);
TV.Select(TN);
End;
end;
Check help on TTreeNodes for a variety of methods that will assist.
Meaning…?
the note is in edit mode and not in the correct location that you cannot read the text you are editing
give up on tlistview use tgrid
Somehow my forum login didn’t work so responding from email
Is this the VCL or FMX tree view since there are a number of tree views available
If it’s the Vcl Treeview then what version of Delphi are you using since there have been some imprivements to controls.
To get the the Treeview to change use a button or a right click event and get the global index (FMX) of the clicked item
Depending on the tree view type each selected item has child objects such as a check box or the text and one can add objects like additional text or a numeric field etc and align them etc
Older versions of Delphi had less functionality in the tree view component unless you were using Dev express or TMS who had data aware and non data aware treeviews (dev express is arguably the best but the control suites are expensive)
If interested I have some code for the FMX tree view as well as the VCL that populates a tree view with data and allows inserts deletes and updates and synchronises these with underlying data
Rgds Ray
I gave up on TListview and can do basically the same with TStringGrid and a Net video showed TStringGrid as much faster anyway.
Other than the lines missing in fixed cells in TStringGrid that you can over ride the draw cells why have windows TListview at all as its a total pain to use!!!
TTreeView is stable after I fund to use Expand to show hidden cells.
Their is a lack of users that are using Delphi because its way over priced.
MS C++ has little cost and Java & Pythion.
So the helps are hard to find your way around so RAD has become a lost FUD
Delphi is about over board functionality and no helps with that functionality to use it
I feel Lazarus with a bad complier still as it cannot hold standard strings well in objects is trying to be Delphi and has a bad help also.
I liked the Delphi 7 error so much until windows 64 stuffed that up
I would go back to Windows XP and Delphi 7 if it was supported rather than Windows 10 and Delphi 12. The FMX is their but it needs to be in all in the base TTreeView object so its not about working things out without a good help on hand.
This is where I’m at and Delphi to me is not that cracked up as the dream it was.
may be I’m gryping a bit but how to you tell Delphi owners they lost the plot!!!