我先建立了一个控件数组MEdit:array [3..10] of TObject;然后在界面上建立了8个TEdit分别是edit3、edit4.....edit10.请问是怎么将界面上的这8个TEdit控件赋给控件数组MEdit中去?

解决方案 »

  1.   

    SetLength(vMenuItemList,vCount);
      for i:=0 to ComponentCount -1 do
      begin
        if (Components[i].ClassName='TMenuItem') then
        begin
          if Components[i].Tag<-1 then Continue;
          vMenuItemList[j]:=TMenuItem(Components[i]);
          Inc(j);
        end;
      end;这是我建立菜单数组的例子,你看看是否合用?
    在FormShow事件里写的,vMenuItemList就是菜单数组。vCount是我计算好的数量。
      

  2.   

    没必要数组了,把这些edit放到一个groupbox或者panel等容器控件里面,然后调用
    (groupbox.component[i] as Tedit).xxx就可以了
      

  3.   

    查找var
       tmpEdit:TEdit;
    for  i:=3 to 10 do 
    begin
        tmpEdit:=self.FindComponent('edit'+inttost(i));
       if tmpEdit<>nil then MEdit[i]:=tmpEdit;
    end;
      

  4.   

    var
      i: Integer;
    begin
      for i := 3 to 10 do
        MEdit[i] := TEdit(findComponent('edit' + IntToStr(i)));
    end;
      

  5.   

    但我要在别外自己做的模块里对这8个Edit赋值呀?
      

  6.   

    c:=3;
    for i:=0 to self.controlCount-1 do
    begin
      if self.controls[i] is tedit then
      begin
        medit[c]:=self.controls[i];
        inc(c);
      end;
    end;
      

  7.   

    >>别外自己做的模块formx.groupboxx.component[i]
      

  8.   

    jinjazz(近身剪(N-P攻略)) :你这也是个方法,但实际情况我做的结构是MVC,那样不就破坏了整体结构了吗?