1:TList是直接从TObject继承二来的一个类,不是可视控件,一般可以把它作为一个对象的容器来用。
2:TList, which stores an array of pointers, is often used to maintain lists of objects.
3:能不能说详细点,最好举个例子!
4:自己看看TList的属性和方法,无非也就是Add,IndexOf等。。。
5:procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TList;
I: Integer;
begin
MyList := TList.Create; {Create a list }
MyList.Add(PChar('A string')); {Add a string}
MyList.Add(PChar('')); { Add an empty string }
MyList.Add(nil); {Add nil }
MyList.Add(PChar('')); { Add another empty string }
Edit1.Text := IntToStr(MyList.Count); {Put count into Edit1}
Mylist.Pack; {Pack the list.}
Edit2.Text := IntToStr(MyList.Count); {Put count into Edit2}
MyList.Free; {Free memory for list}
end;
2:TList, which stores an array of pointers, is often used to maintain lists of objects.
3:能不能说详细点,最好举个例子!
4:自己看看TList的属性和方法,无非也就是Add,IndexOf等。。。
5:procedure TForm1.Button1Click(Sender: TObject);
var
MyList: TList;
I: Integer;
begin
MyList := TList.Create; {Create a list }
MyList.Add(PChar('A string')); {Add a string}
MyList.Add(PChar('')); { Add an empty string }
MyList.Add(nil); {Add nil }
MyList.Add(PChar('')); { Add another empty string }
Edit1.Text := IntToStr(MyList.Count); {Put count into Edit1}
Mylist.Pack; {Pack the list.}
Edit2.Text := IntToStr(MyList.Count); {Put count into Edit2}
MyList.Free; {Free memory for list}
end;