TPopupMenu.OnPopup like functionality for TMainMenu? lazarus / 31-LCL ---------------------------------------------------------------------- Leledumbo · 2014-07-04 07:52 I have an app which uses pluggable architecture. One of the feature is to register menu item from dlls. I want the Caption of TMenuItem(s) to be taken dynamically from a function, so the plugin can supply different Caption based on its current state without the need to manually change its TMenuItem.Caption (the plugin doesn't have reference to its TMenuItem instance). Delphi's solution seems to handle WM_MENUSELECT message, but that's Windows specific since I don't see LM_MENUSELECT counterpart. ---------------------------------------------------------------------- Mike.Cornflake · 2014-07-04 08:32 The pluggable architecture is yours?   Any chance you can add a callback function for populating the menu captions? But as far as messaging go, I can't see anything relevant either.  I think it'd need to be patched in... UPDATE: Sorry - missed that you had the actual question in the Topic title, I tried to infer a question from your post :-( ---------------------------------------------------------------------- Mike.Cornflake · 2014-07-04 08:56 The following code worked for me under Windows - no Linux on hand to test...  Main Menu looks like (So, MenuItem3 is a submenu)   MenuItem1   MenuItem2     MenuItem3 I hooked the OnClick to each Menu... (Three menu items, Code: [Select]procedure TForm1.MenuItem1Click(Sender: TObject); begin   Caption := TMenuItem(Sender).Caption;   If (Sender = MenuItem1) Then     MenuItem3.Caption := DateTimeToStr(Now); end; So basically, it looks like you can get the OnPopup functionality by hooking into the OnClick of the each root menu item... ---------------------------------------------------------------------- Blaazen · 2014-07-04 09:02 I used OnClick of item "Windows" in this case: Code: [Select]File Edit ... Windows Help               Win1               Win2                 ... You can manage subitems of "Windows" menu item this way. It works on QT. ---------------------------------------------------------------------- Leledumbo · 2014-07-04 10:50 Quote from: Blaazen on July 04, 2014, 11:02:03 amI used OnClick of item "Windows" in this case: Code: [Select]File Edit ... Windows Help               Win1               Win2                 ... You can manage subitems of "Windows" menu item this way. It works on QT. Man! Why couldn't I think of it. The top level menu is a TMenuItem as well. Thanks, Blaazen.