Показать сообщение отдельно
  #4  
Старый 25.05.2009, 15:44
Аватар для GLFox
GLFox GLFox вне форума
Прохожий
 
Регистрация: 11.10.2005
Сообщения: 26
Репутация: 10
По умолчанию

Вот, например, функция, которая по имени компонента вида "ParentComponent.SomeChild.Etc" возвращает объект:
Код:
function GetComponent(AOwner: TComponent; sFullName: String;
  var sNameRest: String): TComponent;
var
  iDot0, iDotX: Integer;
  Cmpnt: TComponent;
begin
  Result:=nil;  if sFullName='' then Exit;
  iDot0:=Pos('.',sFullName);
  if iDot0<=0 then iDot0:=$FFFFFF;
  Result:=AOwner.FindComponent(Copy(sFullName,1,iDot0-1));
  if Assigned(Result) then begin
    iDotX:=Length(sFullName);
    while iDotX>0 do begin
      if sFullName[iDotX]='.' then Break;
      Dec(iDotX);
    end;
    if iDotX>1 then begin
      Cmpnt:=GetComponent(Result,Copy(sFullName,iDot0+1,$FFFFFF),sNameRest);
      if Assigned(Cmpnt) then Result:=Cmpnt;
    end;  
  end else sNameRest:=sFullName;
end;
Не уверен в ее абсолютной работоспособности, но может поможет чем...
Можно использовать как-то так:
Код:
(GetComponent(Form1, 'Panel1.Edit1', sSomeString) as TEdit).Text = 'This is the Edit1';
Ответить с цитированием