Skip to content

Need event when menu item is selected (not clicked) #6512

@SoftCircuits

Description

@SoftCircuits

I've been working with the new WinForms code. I know the work is ongoing, so I've been avoiding posting all the issues I'm running into. I can if anyone wants. Right now, it seems somewhat slow, unstable and buggy.

But I do have a feature request that is sorely needed: We have an event when menu items are clicked. But there is no event for when menu items are selected. I think this should be added.

I would like to display a description of the selected menu command in the status bar. This is proving extremely difficult without an event for when menu items are selected. I tried using WndProc to capture the WM_MENUSELECT message. But apparently, WinForms doesn't use standard menus and that message is never sent.

I also tried an approach that involves setting the MouseEnter and MouseLeave event handlers for every menu. I got this working when menu items are selected by the mouse. But I have yet to find a way to do this when a menu item is selected using the keyboard.

It seems like this event wouldn't be hard to add. I really don't understand why it hasn't been added before.

Side Note: If I ever find a way to do this, I thought it might be nice to store the text to be displayed in the menu item's ToolTipText property. However, my testing indicates setting this property causes a tool tip to appear (which I wouldn't want if I displayed that text in the status bar). Unfortunately, the ShowItemToolTips property seems to have no bearing on this. (Those tooltips still show after setting that property to false.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestion(1) Early API idea and discussion, it is NOT ready for implementation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions