Fórum listview #397780
22/03/2011
0
so q não esta funcionando
axo q a ideia sta certo. se puder me socorre em mais esse codigo eu agradeço de mais
var
contador : Integer;
Achou : Boolean;
begin
Achou := False;
If lv1.ItemIndex <> -1 Then
Contador := 0;
If lv1.ItemIndex <> -1 Then
Begin
While Contador <= lv2.Items.Count - 1 do
Begin
If lv2.Items.Item[Contador].Caption = lv1.Items.Item[lv1.ItemIndex].Caption Then
Begin
lv2.Items.(Contador);
Achou := True;
End
Else
Inc(Contador);
End
End;
Lu
Curtir tópico
+ 0Posts
22/03/2011
Lu
Gostei + 0
22/03/2011
Wilson Junior
procedure MudarCaption(NovoTexto: string); var x: integer; TextoAtual: string; begin if ListView1.ItemIndex < 0 then Exit ; TextoAtual := ListView1.Items.Item[ListView1.ItemIndex].Caption; ListView1.Items.Item[ListView1.ItemIndex].Caption := NovoTexto; for x := 0 to ListView2.Count - 1 do begin if ListView2.Items.Item[x].Caption = TextoAtual then ListView2.Items.Item[x].Caption := NovoTexto ; end; end; procedure ButtonClick(Sender: TObject); begin MudarTexto( Edit1.Text ); end;
Espero ter colaborado.
Gostei + 0
22/03/2011
Lu
Gostei + 0
22/03/2011
Lu
If listview_funcionario.ItemIndex <> -1 Then
Contador := 0;
begin
While Contador <= listview_dependente.Items.Count - 1 do
Begin
If listview_dependente.Items.Item[Contador].Caption = listview_funcionario.Items.Item[listview_funcionario.ItemIndex].Caption Then
Begin
???????
Achou := True;
End
Else
Inc(Contador);
desse geito ai ñ sei bem se sta certo e tbm se tiver eu ñ sei oq colocar no espaço q coloquei a interrogação????
Gostei + 0
22/03/2011
Emerson Nascimento
TForm1 = class(TForm)
lv1: TListView;
Button1: TButton;
lv2: TListView;
procedure lv1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
procedure lv1SelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
private
{ Private declarations }
FCaption: string;
public
{ Public declarations }
end; [....] procedure TForm1.lv1Change(Sender: TObject; Item: TListItem;
Change: TItemChange);
var
contador: integer;
begin
if Change = ctText then // se alterou o caption
for Contador := 0 to lv2.Items.Count - 1 do // varre a segunda lista
if lv2.Items.Item[Contador].Caption = FCaption Then // e se o caption for igual
lv2.Items.Item[Contador].Caption := Item.Caption; // troca para o novo caption
FCaption := Item.Caption;
end; procedure TForm1.lv1SelectItem(Sender: TObject; Item: TListItem;
Selected: Boolean);
begin
FCaption := Item.Caption;
end;
Gostei + 0
22/03/2011
Lu
ñ entedi esse q vc mandou
stava tentando esse geito ai so q sta allterando so 1
begin
existe:=true;
for i := 0 to listview1.Items.Count-1 do
begin
if listview1.Items[i].Caption =listview2.Items[i].Caption then
existe:=false;
begin
listview2.Items[i].Caption := listview1.Items[i].Caption;
end;
end;
end;
saberia me informa ond estou errando ou se falta colocar + alguma coisa para allterar todos da 2listview iguais?
Gostei + 0
22/03/2011
Lu
ñ entedi esse q vc mandou
stava tentando esse geito ai so q sta allterando so 1
begin
existe:=true;
for i := 0 to listview1.Items.Count-1 do
begin
if listview1.Items[i].Caption =listview2.Items[i].Caption then
existe:=false;
begin
listview2.Items[i].Caption := listview1.Items[i].Caption;
end;
end;
end;
saberia me informa ond estou errando ou se falta colocar + alguma coisa para allterar todos da 2listview iguais?
todos os captions iguais da listview2
Gostei + 0
22/03/2011
Lu
o que esta faltando agradeço muuuuuuuuuuuuito
Gostei + 0
22/03/2011
Emerson Nascimento
for i := 0 to listview2.Items.Count-1 do
if listview2.Items[i].Caption = listview1.Items[i].Caption then
listview2.Items[i].Caption := listview1.Items[i].Caption;
end;
Gostei + 0
22/03/2011
Lu
so q so allterando o 1 captio se tiverem 2 caption iguais so alltera
um sendo q deveria allterar todos iguais ao 1listview
Gostei + 0
22/03/2011
Lu
for i := 0 to listview2.Items.Count-1 do
begin
if listview2.Items[i].Caption =listview1.Items[i].Caption then
existe:=false;
begin
listview2.Items[i].Caption := listview1.Items[i].Caption;
end;
end;
?????????
não sta dando certoooo,
so sta allterando 1 caption igual da 2ºlistview sendo q deveria altera todos
ue sao iguais
ja esto muuuito preocupado com esse erro
preciso de ajuda nesse codigo
Gostei + 0
23/03/2011
Lu
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)