Recent

Author Topic: [Solved] Add TAction programmatically  (Read 198 times)

Edson

  • Hero Member
  • *****
  • Posts: 1249
[Solved] Add TAction programmatically
« on: July 05, 2022, 04:30:54 am »
Hi.

Is it possible to add a new TAction to an ActionList control programmatically?  How?

I was searching about it with no success.


Thanks
« Last Edit: July 05, 2022, 05:34:56 am by Edson »
Lazarus 2.0.10 - FPC 3.2.0 - x86_64-win64 on Windows 8

Wallaby

  • New Member
  • *
  • Posts: 47
Re: Add TAction programmatically
« Reply #1 on: July 05, 2022, 04:51:47 am »
Pretty simple:

Code: Pascal  [Select][+][-]
  1.  Action := TAction.Create(YourActionList);
  2.  Action.ActionList := YourActionList;
  3.  Action.ShortCut := ...
  4.  Action.Caption := ...
  5.  Action.OnUpdate := ...
  6.  Action.OnExecute := ...

Edson

  • Hero Member
  • *****
  • Posts: 1249
Re: Add TAction programmatically
« Reply #2 on: July 05, 2022, 05:34:38 am »
Thank you.

I was looking for a TACtionList.Add() method. But it wasn't the way.
Lazarus 2.0.10 - FPC 3.2.0 - x86_64-win64 on Windows 8

 

TinyPortal © 2005-2018