AIMP Forum

AIMP for PC => Skin Editor, Skin Engine => Вопросы / Questions => Topic started by: Seque on December 20, 2023, 18:53:28

Title: How to obtein 'State' from TComponent?
Post by: Seque on December 20, 2023, 18:53:28
Hi, this is a sample code:

procedure Execute(Sender, Arguments: TComponent);
var
  Object : TComponent;
  i : Integer;
begin
  i := Arguments.Get('State');
  Object := FindObject('Animator');
  Object.BeginUpdate;
  Object.Set('Visible',i);
  Object.EndUpdate;
end;

I need to obtain 'State' from pause button, this code is implement on OnClick event in pause button. When is paused an animation hide and when is playing the animation must be shown. In this code 'i' always is 0

Thanks in advance
Title: Re: How to obtein 'State' from TComponent?
Post by: Artem on December 21, 2023, 08:13:46
I need to obtain 'State' from pause button

Sender.Get('State');

Title: Re: How to obtein 'State' from TComponent?
Post by: Seque on December 21, 2023, 11:24:41
Sender.Get('State');

Thanks, but doesn't work... if i use Sender.Get('State'); throws "Error at 6:3 - Property does not exist."
Title: Re: How to obtein 'State' from TComponent?
Post by: Artem on December 21, 2023, 12:35:25
Can you share a small example that illustrates the issue?
Title: Re: How to obtein 'State' from TComponent?
Post by: Seque on December 21, 2023, 13:05:51
Can you share a small example that illustrates the issue?

I have a button named "btnPausa" and onClick event this script:
procedure Execute(Sender, Arguments: TComponent);
var
  Object : TComponent;
  i : Integer;
begin
  i := Sender.Get('State');
  Object := FindObject('Animator');
  Object.BeginUpdate;
  Object.Set('Visible',i);
  Object.EndUpdate;
end;
Title: Re: How to obtein 'State' from TComponent?
Post by: Black_AVP_Bim on December 21, 2023, 13:39:03
... When is paused an animation hide and when is playing the animation must be shown.

(https://www.aimp.ru/forum/index.php?action=dlattach;topic=72039.0;attach=70091)
Title: Re: How to obtein 'State' from TComponent?
Post by: Artem on December 21, 2023, 13:39:21
Sorry, my fault. Try this approach:
Code: [Select]
procedure Execute(Sender, Arguments: TComponent);
var
  Bindings: TASEBindings;
begin
  Bindings := Sender.Get('Bindings');
  OutputDebugString(Bindings.GetDataAsInteger('State'))
end;