FMX how to cast Tbutton and assigning it with Tag in TAction / TActionList?

66 Views Asked by At

I have TButton(s) associated to the same action TAction and When they are clicked, the action execute method declared. Now i want to cast the Sender parameter in the actions OnExecute/OnUpdate instruction to show which Button was clicked.

what i did :

procedure TMainForm.ActListViewUpdate(Sender: TObject);
begin
  if (sender is TAction) then
  begin
    case (Sender as TButton).Tag of
      1: ShowMessage(inttostr((sender as Tbutton).tag ));
      2: ShowMessage(inttostr((sender as Tbutton).tag ));
    end;
  end;
end;

Doesn't work. Could you point me to the right way?

0

There are 0 best solutions below