请问下面这段代码什么意思 procedure TfrmCreep.Button1Click(Sender: TObject); procedure ChangeItem(AComboBox:TComboBox); var I:integer; AStrings:array of String; begin if AComboBox.Items.Indexof(AComboBox.text)>=0 then setlength(AStrings,AComboBox.Items.Count) else setlength(AStrings,AComboBox.Items.Count+1); AStrings[0]:=AComboBox.text; if AComboBox.Items.Indexof(AComboBox.text)>=0 then begin AComboBox.Items.Delete(AComboBox.Items.Indexof(AComboBox.text)); AComboBox.text:=AStrings[0]; end; if AComboBox.Items.Count>=1 then begin for I:=1 to AComboBox.Items.Count do AStrings[I]:=AComboBox.Items[I-1]; end; AComboBox.Items.Clear; for I:=0 to High(AStrings) do AComboBox.Items.Add(AStrings[I]); if AComboBox.Items.Count >= 51 then AComboBox.Items.Delete(50); end;
procedure是过程的意思,dep为过程名称(过程参数)
procedure dep()是你自定义的一个过程
方法中:有返回值的称函数(functiono),没返回值的称过程(procedure).
过程中的var ep1:Tep1T是形参,执行完后会返回计算得到的值.即这个参数可能有变化.
procedure TfrmCreep.Button1Click(Sender: TObject);
procedure ChangeItem(AComboBox:TComboBox);
var
I:integer;
AStrings:array of String;
begin
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
setlength(AStrings,AComboBox.Items.Count)
else
setlength(AStrings,AComboBox.Items.Count+1);
AStrings[0]:=AComboBox.text;
if AComboBox.Items.Indexof(AComboBox.text)>=0 then
begin
AComboBox.Items.Delete(AComboBox.Items.Indexof(AComboBox.text));
AComboBox.text:=AStrings[0];
end;
if AComboBox.Items.Count>=1 then
begin
for I:=1 to AComboBox.Items.Count do
AStrings[I]:=AComboBox.Items[I-1];
end;
AComboBox.Items.Clear;
for I:=0 to High(AStrings) do
AComboBox.Items.Add(AStrings[I]);
if AComboBox.Items.Count >= 51 then
AComboBox.Items.Delete(50);
end;