Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3427552
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T06:51:02+00:00 2026-05-18T06:51:02+00:00

I am trying to dynamically add actionitems, I can add the item and it

  • 0

I am trying to dynamically add actionitems, I can add the item and it works when I do this:

HostActionItem := ActionManager.ActionBars[0].Items[0].Items[2];
  NewItem := HostAction.Items.Add;
  NewItem.Action :=  MyActionToPerform;
  NewItem.Caption := Description;
  NewItem.ImageIndex := 1;
  NewItem.Tag := 13;

However, when the action Execute method fires I attempt to get the ActionComponent from the Sender object like this:

  if (Sender is TAction) then
  tag := (Sender As TAction).ActionComponent.Tag;

But the ActionComponent is always nil. Why is the ActionComponent not being initialised?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T06:51:03+00:00Added an answer on May 18, 2026 at 6:51 am

    short answer:

    You’re expecting a TActionClientItem to show up as ActionComponent of an TAction. That won’t happen since TActionClientItem does not descend from TComponent.

    longer answer:

    I believe you’re adding your item to a menu bar. It seems to be by design that an TAction linked to a menu item would not support the ActionComponent. The items of a menu bar is of type TActionClientItem. This is a ‘collection item’, not a ‘component’. Hence the menu cannot fill in the ActionComponent parameter with the menu item when calling the Execute method of the action link of the selected item. If this sounds confusing, I guess the below quotes from the VCL source would make it clear:

    TBasicActionLink.Execute method:

    function Execute(AComponent: TComponent = nil): Boolean; virtual;
    

    The passed component is assigned to FAction.ActionComponent before it is executed.

    How it’s called from TCustomActionMenuBar.ExecAction:

    FSelectedItem.ActionLink.Execute;
    

    For the question in the title, I don’t think you’re doing anything wrong, apart from setting the Caption and ImageIndex of a TActionClientItem is unnecessary, as it’s the TAction‘s title and image which will be shown.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
I'm trying to dynamically add items to a toolstrip with the following code: contextMenuStrip.Items.Add(string.Format({0}
I'm trying to dynamically add results to this display and I simply want to
I am trying to dynamically add data points to jqplot as a result of
I'm trying to dynamically add a span to an ol, where the counter should
I'm trying to dynamically add a validation rule to some dynamic controls: $(input[id*=Hours]).rules(add, required);
I have a page that I am trying to dynamically add some links to.
So, I'm trying to dynamically add a button to a site to give the
I am using the Flex SDK within visual studio and trying to dynamically add
I have a site with three tabs that I'm trying to dynamically add mouseover/mouseout

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.