I am trying to replace the stringgrid1 and stringgrid2 with listbox1 and listbox2 respectively. Is their any way I can do it? If listbox can not do may anyone suggest what I should use instead of stringgrid to display the information? I'm a newbie to Delphi.
This is my code:
procedure TForm2.FormCreate(Sender: TObject);
var i:integer;
begin
stringgrid1.ColWidths[0]:=20;
stringgrid2.ColWidths[0]:=20;
for i:=1 to 50 do begin
stringgrid1.Cells[0,i]:=inttostr(i-1);
stringgrid2.Cells[0,i]:=inttostr(i-1);
stringgrid2.Cells[1,i]:='0';
end;
stringgrid2.Cells[1,0]:='name';
stringgrid1.Cells[1,0]:='extension';
stringgrid1.Cells[2,0]:='format';
stringgrid1.Cells[3,0]:='size';
stringgrid1.Cells[4,0]:='date';
stringgrid1.Cells[5,0]:='addres';
end;
procedure TForm2.StringGrid2DblClick(Sender: TObject);
begin
if (stringgrid2.Cells[1,stringgrid2.Row]<>'1024') and (stringgrid2.Cells[1,stringgrid2.Row]<>'0') then
stringgrid1.Row:=strtoint(stringgrid2.Cells[1,stringgrid2.Row]);
end;
end.
Procedure HD;
var i:integer;
begin
for i:=0 to 50 do begin
form2.StringGrid1.Cells[1,i+1]:=TABLE[i].name;
form2.StringGrid1.Cells[2,i+1]:=TABLE[i].format;
if TABLE[i].tip then
form2.StringGrid1.Cells[3,i+1]:='folder'
else
form2.StringGrid1.Cells[3,i+1]:='file';
form2.StringGrid1.Cells[4,i+1]:=inttostr(TABLE[i].nach);
form2.StringGrid1.Cells[5,i+1]:=inttostr(TABLE[i].razmer);
form2.StringGrid2.Cells[1,i+1]:=inttostr(fat[i]);;
end;
end;
TListViewinvsReportview style rather than a listbox. - David Heffernan