Link to home
Start Free TrialLog in
Avatar of SHAHEEN_AKHTAR
SHAHEEN_AKHTARFlag for India

asked on

TMenuItem - OnMouseOver

TMenuItem does not have OnMouseOver event.  My requirement is I need to generate MenuItem's submenu dynamically when the user places the mouse over the menu item. This is because, The Submenu contents are changed very fequently and I want that the user should get the latest of the menu. Presently I am using a timer to handle this. The information to populate the submenuitems is gathered by downloading related XML files.
I tried to do with OnPopup event handler of the popup menu but it starts download simultaneously which occupies the network resource.

Is there a way out to achieve onMouseOver kind of thing for TMenuItem.

Thanks and regards
ASKER CERTIFIED SOLUTION
Avatar of Lukasz Zielinski
Lukasz Zielinski
Flag of Poland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you may be able to do something with

procedure TCustomForm.WMMenuSelect(var Message: TWMMenuSelect); message WM_MENUSELECT;

this message is called when a menu item is selected
check the Forms unit for more code
Avatar of SHAHEEN_AKHTAR

ASKER

I have used the following procedure but nothing is happenning. I am using popup menu not mainmenu.
Can some give me some example code how can I achieve this.

procedure TForm4.WMMENUSELECT(var Msg: TWMMENUSELECT);
var menuItem : TMenuItem;
    hSubMenu : HMENU;
begin
  inherited; // from TCustomForm

  if Msg.menu=PopupMenu1.handle then
      ShowMessage('Selected' );
end;