procedure TinputcommF.change(sender:tobject); var s:string; begin if sender is tcombobox then begin s:=combobox.text; end;end;
控件的事件也是一个属性,是一个指针 这样:下 begin Parent:=scrollbox1; left:=mylabl1.Width+20; name:='combobox'+inttostr(i1); Top:=w; onchange:= self.change//将事件指针指向你的函数
while not eof(f1) do // 给comboboxi.tems赋值,值从文本文件中来 begin readln(f1,temps); k3:=pos(',',temps); s1:=copy(temps,1,k3-1); s2:=copy(temps,k3+1,length(temps)-k3); items.Add(s1); end; i1:=i1+1; onchange:=change; 现在的问题如下我想要combobox响应onchange事件,把combobox的text赋值给变量 procedure TinputcommF.change(sender:tobject); begin if sender is tcombobox then begin
var
s:string;
begin
if sender is tcombobox then
begin
s:=combobox.text;
end;end;
这样:下
begin
Parent:=scrollbox1;
left:=mylabl1.Width+20;
name:='combobox'+inttostr(i1);
Top:=w; onchange:= self.change//将事件指针指向你的函数
while not eof(f1) do // 给comboboxi.tems赋值,值从文本文件中来
begin
readln(f1,temps);
k3:=pos(',',temps);
s1:=copy(temps,1,k3-1);
s2:=copy(temps,k3+1,length(temps)-k3);
items.Add(s1);
end;
i1:=i1+1;
onchange:=change;
现在的问题如下我想要combobox响应onchange事件,把combobox的text赋值给变量
procedure TinputcommF.change(sender:tobject);
begin
if sender is tcombobox then
begin
end;end;
既然是动态建立,
onchange事件中就不可能出现下面的写法
如
s:=combobox.text ??? combobox根本就不存在
s:=InputCommF.Text ???这是在取form的caption