cptngrb Posted October 9, 2019 Share Posted October 9, 2019 I load in treeview my data from database and i want add childs on expand node. To do this in fist time add node and if has a children add empty child node to get a plus, but when expand node for a short time there is an empty node, and then the real children. How can this be avoided? procedure TMainForm.LoadChilds(const ANodeID: integer; const ANode: TUniTreeNode); var Node: TUniTreeNode; NodeData: PVSTRecord; FirstStep: boolean; begin if Assigned(ANode) then if PVSTRecord(ANode.Data).Expanded then exit; trView.BeginUpdate; try with UniMainModule.ODS do begin Close; DeleteVariables; DeclareVariable('acur', otCursor); DeclareAndSet('aid_parent', otInteger, ANodeID); DeclareAndSet('aid_user', otInteger, ID_USER); Open; FirstStep:= True; while not eof do begin if FirstStep then begin if Assigned(ANode) then begin if ANode.HasChildren then begin Node:= ANode.GetFirstChild; Node.Text:= FieldByName('name_').AsString; end else Node:= trView.Items.Add(ANode, FieldByName('name_').AsString); end else Node:= trView.Items.Add(ANode, FieldByName('name_').AsString); FirstStep:= False; end else begin Node:= trView.Items.Add(ANode, FieldByName('name_').AsString); end; if FieldByName('child_cnt').AsInteger > 0 then //Node.HasChildren:= (FieldByName('child_cnt').AsInteger > 0); trView.Items.Add(Node, ''); new(NodeData); NodeData.NodeID := FieldByName('id_node').AsInteger; NodeData.NodeParentID:= FieldByName('id_par').AsInteger; NodeData.NodeName := FieldByName('name_').AsString; NodeData.Count := FieldByName('child_cnt').AsInteger; NodeData.Expanded:= False; NodeData.Read:= 1; NodeData.NodeType:= FieldByName('id_type').AsInteger; NodeData.ShablonID:= FieldByName('id_shablon').AsInteger; Node.Data:= NodeData; Next; end; CloseAll; end; if Assigned(ANode) then PVSTRecord(ANode.Data).Expanded:= True; finally trView.EndUpdate; end; end; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 9, 2019 Share Posted October 9, 2019 21 minutes ago, cptngrb said: I load in treeview my data from database and i want add childs on expand node. To do this in fist time add node and if has a children add empty child node to get a plus, but when expand node for a short time there is an empty node, and then the real children. How can this be avoided? Hello, Can you please specify first, which edition and build of UniGUI are you using? Quote Link to comment Share on other sites More sharing options...
cptngrb Posted October 9, 2019 Author Share Posted October 9, 2019 uni-1.90.0.1509 Quote Link to comment Share on other sites More sharing options...
cptngrb Posted October 9, 2019 Author Share Posted October 9, 2019 delphi rio.2 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 9, 2019 Share Posted October 9, 2019 14 minutes ago, cptngrb said: uni-1.90.0.1509 If you are not using trial version please visit here: Quote Link to comment Share on other sites More sharing options...
cptngrb Posted October 10, 2019 Author Share Posted October 10, 2019 trial version. I want to try before purchasing Quote Link to comment Share on other sites More sharing options...
cptngrb Posted October 10, 2019 Author Share Posted October 10, 2019 I have a few basic things in development, and if your product solves them out of the box, I'll be happy to use them Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.