PAGUE 6 MESES
LEVE 12 MESES
GARANTIR DESCONTO

Fórum VirtualTreeView #388905

20/10/2010

0

Boa Noite, estou tentando usar o componente VirtualTreeView mas não estou conseguindo obter resultados satisfatórios.

Criei a seguinte estrutura para um treviiew de banco/agencia/conta:     type
  PData = ^TData;
  TData = record
    Banco_Codigo   : String;
    Banco_Nome     : String;
    Agencia_Codigo : String;
    Agencia_Nome   : String;
    Conta_conta    : String;
  end;
a minha intenção era fazer algo do tipo   +237-Bradesco  +Agencia 211 - Tutoia   - conta :001   - conta :002   +341-Itau  +Agencia 0338 - Paulista   - conta :011   - conta :235   Fiz um select que está me trazendo as linhas nessa ordem:   237 bradesco  211  tutoia   001 237 bradesco  211  tutoia   002 341 itau     0338  paulista 011 341 itau     0338  paulista 235     procedure TfrmCaixa0.MontaTreeBanco;
begin
  vtContaBanco.BeginUpdate;
  vtContaBanco.Clear;
  vtContaBanco.NodeDataSize := Sizeof(TData);
  vtContaBanco.RootNodeCount := dm.cds_contabanco.RecordCount;
  vtContaBanco.SortTree(0,sdAscending,true);
  dm.cds_contabanco.First;
  vtContaBanco.EndUpdate;
end;

procedure TfrmCaixa0.vtContaBancoInitNode(Sender: TBaseVirtualTree; ParentNode,
  Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates);
var
  BancosConta : PData;
begin
  BancosConta := Sender.GetNodeData(Node);
  Initialize(BancosConta^);
  BancosConta.Banco_Codigo   := DM.cds_ContaBanco.FieldByName('bcocod').AsString;
  BancosConta.Banco_Nome     := DM.cds_ContaBanco.FieldByName('bconom').AsString;
  BancosConta.Agencia_Codigo := DM.cds_ContaBanco.FieldByName('agecod').AsString;
  BancosConta.Agencia_Nome   := DM.cds_ContaBanco.FieldByName('agenom').AsString;
  BancosConta.Conta_conta    := DM.cds_ContaBanco.FieldByName('cctnum').AsString;
  if not DM.cds_ContaBanco.Eof then
     DM.cds_ContaBanco.Next;
end;

procedure TfrmCaixa0.vtContaBancoGetText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
  var CellText: string);
var
  BancosConta : PData;
begin
  BancosConta := Sender.GetNodeData(Node);
  if Column = -1 then
      CellText := BancosConta.Banco_Codigo + '-' + BancosConta.Banco_Nome
  else if Column = 0 then
      CellText := BancosConta.Agencia_Codigo
procedure TfrmCaixa0.vtContaBancoGetText(Sender: TBaseVirtualTree;
  Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
  var CellText: string);
var
  BancosConta : PData;
begin
  BancosConta := Sender.GetNodeData(Node);
  if Column = -1 then
      CellText := BancosConta.Banco_Codigo + '-' + BancosConta.Banco_Nome
  else if Column = 0 then
      CellText := BancosConta.Agencia_Codigo + '-' + BancosConta.Agencia_nome
  else if Column = 1 then
      CellText := BancosConta.Banco_Conta   else CellText := '';

end;
  Desde já agradeço o apoio!
_osw

_osw

Responder

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

Aceitar