zu 1.)
So geht es mit Buttons. Mit einer Progressbar entsprechend:
Delphi-Quellcode:
type
TForm1 = class(TForm)
ListView1 : TListView;
procedure FormCreate(Sender : TObject);
procedure ListView1CustomDraw(Sender : TCustomListView;
const ARect : TRect; var DefaultDraw : Boolean);
private
{ Private-Deklarationen }
procedure MyButtonClick(Sender : TObject);
public
{ Public-Deklarationen }
end;
var
Form1 : TForm1;
implementation
{$R *.dfm}
uses
StdCtrls;
var
MyButton : array of TButton;
procedure TForm1.MyButtonClick(Sender : TObject);
var
s : string;
begin
s := ListView1.Items[(Sender as TButton).Tag].Caption;
ShowMessage(s);
end;
procedure TForm1.FormCreate(Sender : TObject);
var
i : Integer;
begin
setlength(MyButton, Listview1.Items.Count);
for i := 0 to ListView1.Items.Count - 1 do
begin
MyButton[i] := TButton.Create(ListView1);
MyButton[i].Parent := Listview1;
end;
end;
procedure TForm1.ListView1CustomDraw(Sender : TCustomListView;
const ARect : TRect; var DefaultDraw : Boolean);
var
i : Integer;
begin
setlength(MyButton, Listview1.Items.Count);
for i := 0 to Listview1.Items.Count - 1 do
begin
MyButton[i].Parent := Listview1;
MyButton[i].Left := Listview1.Left + Listview1.Columns.Items[0].Width;
MyButton[i].Top := 18 + i * 14;
MyButton[i].Height := 12;
MyButton[i].Width := ListView1.Columns[1].Width;
MyButton[i].Tag := i;
MyButton[i].Caption := ListView1.Items[i].Caption;
MyButton[i].OnClick := MyButtonClick;
end;
end;
zu 2.) Kuck dir mal den Virtual Treeview von Mike Lischke an, der sollte sowas können.