Fórum TJvTreeViewCheck ao carregar não checked o avvo #536840
10/11/2015
0
Utilizando o componete, ele busca na tabela do banco, os itens que estão como boolean e então deve checar para item ao carrgar no form, mas não esta carregando o avo.
if TVMenuPerfil.Items.Item[i].Text<>'' then
begin
Node1 := TJvTreeNode(TVMenuPerfil.Items.Item[i]);
Node1.Checked := True;
TVMenuPerfil.Refresh;
try
if TVMenuPerfil.Checked[TVMenuPerfil.Items.Item[i] ] then
begin
nFilho := Node1;
nPai := nFilho.GetPrev;
nAnt := nPai;
nAntAvo:=nAvo;
nAvo:= nPai.GetPrev;;
if (nPai <> nil) and (nFilho.HasAsParent(nPai)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nPai] := True;
end
else
begin
while ((not nFilho.HasAsParent(nPai)) or (not nAnt.HasAsParent(nPai))) and (nPai <> nil) do
begin
nAnt := nPai;
nPai := nAnt.GetPrev;
end;
end;
if (nPai <> nil) and (nFilho.HasAsParent(nPai)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nPai] := True;
end;
///avo checado
if (nAvo <> nil) and (nPai.HasAsParent(nAvo)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nAvo] := True;
end
else
begin
while ((not nPai.HasAsParent(nAvo)) or (not nAntAvo.HasAsParent(nAvo))) and (nAvo <> nil) do
begin
nAntAvo := nAvo;
nAvo := nAntAvo.GetPrev;
end;
end;
if (nAvo <> nil) and (nPai.HasAsParent(nAvo)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nAvo] := True;
end;
TVMenuPerfil.Refresh;
end;
except
end;
end;
if TVMenuPerfil.Items.Item[i].Text<>'' then
begin
Node1 := TJvTreeNode(TVMenuPerfil.Items.Item[i]);
Node1.Checked := True;
TVMenuPerfil.Refresh;
try
if TVMenuPerfil.Checked[TVMenuPerfil.Items.Item[i] ] then
begin
nFilho := Node1;
nPai := nFilho.GetPrev;
nAnt := nPai;
nAntAvo:=nAvo;
nAvo:= nPai.GetPrev;;
if (nPai <> nil) and (nFilho.HasAsParent(nPai)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nPai] := True;
end
else
begin
while ((not nFilho.HasAsParent(nPai)) or (not nAnt.HasAsParent(nPai))) and (nPai <> nil) do
begin
nAnt := nPai;
nPai := nAnt.GetPrev;
end;
end;
if (nPai <> nil) and (nFilho.HasAsParent(nPai)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nPai] := True;
end;
///avo checado
if (nAvo <> nil) and (nPai.HasAsParent(nAvo)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nAvo] := True;
end
else
begin
while ((not nPai.HasAsParent(nAvo)) or (not nAntAvo.HasAsParent(nAvo))) and (nAvo <> nil) do
begin
nAntAvo := nAvo;
nAvo := nAntAvo.GetPrev;
end;
end;
if (nAvo <> nil) and (nPai.HasAsParent(nAvo)) then
begin
TJvCheckTreeView(FormCadastroPerfil).Checked[nAvo] := True;
end;
TVMenuPerfil.Refresh;
end;
except
end;
end;
Janaina
Curtir tópico
+ 0
Responder
Clique aqui para fazer login e interagir na Comunidade :)