How to move items between 2 TreeView dynamically?

0

I have a TreeView that receives the fields from a database as items. I wanted to link these fields to another TreeView that already has a predefined structure. It would look something like this:

This link is currently used by dragging items from left to right.

    
asked by anonymous 11.05.2016 / 16:35

1 answer

0

As the items in my right TreeView are fixed, I solved the problem by adding one at a time along with your child. Here is the code:

// Adding items to TreeView

TTreeNode *noPai;

noPai = trvDestino->Items->Add(NULL,"Matrícula");
trvDestino->Items->AddChild(noPai,trvOrigem->Items->Item[0]->Text);

noPai = trvDestino->Items->Add(NULL,"Unidade");
trvDestino->Items->AddChild(noPai,trvOrigem->Items->Item[1]->Text);

noPai = trvDestino->Items->Add(NULL,"Gabarito");
trvDestino->Items->AddChild(noPai,trvOrigem->Items->Item[2]->Text);

noPai = trvDestino->Items->Add(NULL,"Respostas");
for(int i=3;i< trvOrigem->Items->Count; i++){
  trvDestino->Items->AddChild(noPai,trvOrigem->Items->Item[i]->Text);
}
    
12.05.2016 / 19:15