Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
935
Popup menu event to use for menu close
posted

Hello,

I am using a control with Context menu which can be dropped down for the user to select a button tool to trigger some actions. I would like to react both to the Tool Click event occurring when the user clicks on a tool, and also to an event indicating the menu has closed without a Tool being clicked. The source control would take actions in response to this "cancel" event.

The ToolClose up event always occurs when the menu closes but it occurs before the Tool Click event. In this case, the source control doesn't know if the Tool Click event will follow and so doesn't know whether ToolClose means Cancel or ToolClick is following with a desired action.

Are there any other events, I can use. Mouse up will occur after Click, also Deactivate could be used but I can't find the Form/Control that get these events to trigger Cancel.Tool Close method based on the mouse position on or off the popup menu could be used if could find the menu rectangle.

Any ideas? Thanks,

Wendy

Parents
  • 935
    Verified Answer
    posted

    Hello,

    Further testing has shown I can trap the UIElement when the menu is first shown. After PopupMenu.ShowPopUp() ...

    popupUIE = ultraToolbarsManager1.UIElementFromPoint(

     

    Control.MousePosition)

    This will trap the UIControlElement. With this element, in the ToolCloseUp event, I can check the LastElementEntered. If null, then no ToolClick will follow and user has clicked outside the menu area; if not null, then ToolClick will follow.

    Regards,

    Wendy

Reply Children