Take the 2-minute tour ×

I am struggling greatly trying to get hints displayed in a TActionMainMenuBar. Delphi XE2.

I am creating the menus at runtime. I add categories, subitems, clear the menu out, that all works great. Clicking on the menu item works properly (for now it just does a ShowMessage with the action item tag but that's fine).

This is the code that adds a new menu item :

function TActionF.NewAction(AParent: TActionClientItem; Caption: String; aTag : integer; ExecuteAction: TNotifyEvent):TActionClientItem;
  newActionClient : TActionClientItem;
  AnewAction : TAction;
  newActionClient := TActionClientItem(AParent.Items.insert(AParent.Items.Count));
  newActionClient.Caption := Caption; //??
  newActionClient.UsageCount := -1; // turn of menu priority stuff for now
  AnewAction := TAction.Create(Self);
  AnewAction.Tag := aTag;
  AnewAction.ImageIndex := -1;
  AnewAction.Caption := Caption;
  AnewAction.Hint := Caption + 'Action Tag = ' + IntToStr(aTag);
  AnewAction.OnHint := acnDoHint;  // fixed, could be parameter, but onHint is never called    !!??
  AnewAction.OnExecute := ExecuteAction; // passed as parameter
  newActionClient.Action := AnewAction;
  Result := newActionClient;

I am setting the Hint" of the action. I have also experimented with assigning the OnHint, but the OnHint is never called. I simply cannot get at that hint when browsing the menu.

I have ShowHint set True everywhere I can see a place to do it.

The problem is that I cannot get any menu hints displayed no matter what I try. If i could just get at it I could display it myself (if the program won't). The OnHint is never called.

I have posted the full source of my menu program (Delphi XE2) , a small example narrowed down as best I could, in my public DropBox if anyone wants to see the program.


share|improve this question
Where do you expect the hint to be displayed? Menu items don't get tool-tips. –  Rob Kennedy Oct 25 '12 at 17:48
To display hints for menu items, you need to add a TStatusBar to your form, and set it's AutoHint property to True. As @Rob says, menu items don't get pop-up tool tips. –  Ken White Oct 25 '12 at 18:19
Thank you for the feedback. I was in the past able to access the menu hints for TMenuItems when I was using TMainMenu, and I could display them in a popup window, but the hints for the actionmenu items I still can't get to. With trial and error, I can now get at the hints for the Category actions (the menu headers) but not the submenu actionitem hints. That I consider good news, since it means the hints are there at least in the categories. Thanks again for the help. –  mthand Oct 26 '12 at 0:09
add comment


Your Answer



Browse other questions tagged or ask your own question.