AIMP Forum

AIMP for Windows => Skin Editor, Skin Engine => Вопросы / Questions => Topic started by: Reekawz on August 26, 2017, 01:46:09

Title: How to change object parent via script?
Post by: Reekawz on August 26, 2017, 01:46:09
Can someone please give me some example on how i can change the parent of an object using the ScriptableOperatorCounter, i did the script below but always have the error messages: ''I/O Error 105'', or "Invalid property type"

procedure Execute(var State: Integer);
var
  Component: TComponent;
begin
  Component := FindObject('button');
  Component.parent := FindObject('containerA');
  Component.parent := FindObject('containerB');
case State of
1:
begin
  Component.BeginUpdate;
  Component.Set('Component.Parent', ''containerA');
  Component.EndUpdate;
end;
0:
begin
  Component.BeginUpdate;
  Component.Set('Component.Parent', 'containerB');
  Component.EndUpdate;
end;
end;
end;

Thanks in advance.
Title: Re: How to change object parent via script?
Post by: Artem on August 26, 2017, 10:04:39
It should looks like:
Code: [Select]
  ACommonPanel := FindObject('tcpPlaybackControl');
  ACommonPanel.Parent := FindObject('tcTrackInfo');

May be, in your case, one of the objects = nil?
Title: Re: How to change object parent via script?
Post by: Reekawz on August 26, 2017, 17:12:35
hey! it worked! thanks for the reply  :)