PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum TreeView #367553

06/01/2009

0

Olá,

Estou enfrentando problemas ao tentar popular um TreeView com Itens e SubItens, alguém teria algum material sobre treeview.

ps. Estou utilizando para montar um controle de acesso

Obrigado


D@niel

D@niel

Responder

Posts

06/01/2009

D@niel

Caso seja útil para alguém segue uma solução que encontrei.

procedure Tfrm_Cad_Usuario.BitBtn6Click(Sender: TObject);
Var
        n0, n1: TTreeNode;
        i : integer;
begin

        n0 := TTreeNode.Create(tvw.Items);

        i := 0;

        cds_ObjDetail.First;

        While not cds_ObjMaster.Eof Do
        Begin

                n0.Text := cds_ObjMasterDESCRICAO.Value;

                tvw.Items.Add(n0, n0.Text);

                with cds_ObjDetail Do
                Begin
                        Filtered := False;
                        Filter   := ´ID_OBJETO_PAI = ´ + cds_ObjMasterID_OBJETO.AsString;
                        Filtered := True;
                End;

                While not cds_ObjDetail.Eof Do
                Begin

                        tvw.Items.AddChild(tvw.Items[i], cds_ObjDetailDESCRICAO.Value);

                        cds_ObjDetail.Next;
                End;

                cds_ObjMaster.Next;

                i := i + 1 + cds_ObjDetail.RecordCount;

        End;
end;



Até +


Responder

Gostei + 0

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar