Jump to content

cptngrb

Members
  • Posts

    5
  • Joined

  • Last visited

cptngrb's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. 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
  2. trial version. I want to try before purchasing
  3. 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;
×
×
  • Create New...