アクションアイテムを動的に追加しようとしています。アイテムを追加でき、これを行うと機能します。
HostActionItem := ActionManager.ActionBars[0].Items[0].Items[2];
NewItem := HostAction.Items.Add;
NewItem.Action := MyActionToPerform;
NewItem.Caption := Description;
NewItem.ImageIndex := 1;
NewItem.Tag := 13;
ただし、アクションの Execute メソッドが起動すると、次のように Sender オブジェクトから ActionComponent を取得しようとします。
if (Sender is TAction) then
tag := (Sender As TAction).ActionComponent.Tag;
しかし、ActionComponent は常に nil です。ActionComponent が初期化されていないのはなぜですか?