Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   De ListBox a ListView (https://www.clubdelphi.com/foros/showthread.php?t=28611)

Mr.Vaka 25-12-2005 13:51:07

De ListBox a ListView
 
Nesesito convertir este codigo para que lo use una Listview exactamente esto
Código:

FlatListBox1.Items[FlatListBox1.itemindex];
Aqui pongo el codigo completo.
Código:

var
RemoteFile,SaveLocalAs, CurrentDir : string;
begin
RemoteFile:=CurrentDir+FlatListBox1.Items[FlatListBox1.itemindex];
savedialog1.FileName:= FlatListBox1.Items[FlatListBox1.itemindex];

Aver si alguien me puede echar una mano. Gracias

[Gunman] 25-12-2005 16:50:03

La solución:
Código Delphi [-]
var
  RemoteFile, SaveLocalAs, CurrentDir : String;
begin
  if FlatListView1.ItemIndex >= 0 then
  begin
    RemoteFile := CurrentDir + FlatListView1.Items[FlatListView1.ItemIndex].Caption;
    SaveDialog1.FileName := FlatListView1.Items[FlatListView1.ItemIndex].Caption;
  end
  else
    ShowMessage('No hay seleccionado ningún item!');
end;

He añadido unas línias que comprueban si hay items seleccionados en el ListView (if ... else ...) si no hay muestra un mensaje. ;)

Mr.Vaka 25-12-2005 18:04:18

Muchas gracias por tu ayuda!

[Gunman] 25-12-2005 18:54:01

No hay de que!


La franja horaria es GMT +2. Ahora son las 08:57:10.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi