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
40
PopupMenuTool drag & drop
posted

I've created a PopupMenuTool with some attached buttons on a ribbon bar. I want to be able to drag & drop items onto said buttons. However, having picked up the drag event on the PopupMenuTool and called DropDown to open it successfully, I can't seem to find how to then get a drag/drop/mouseover/anything event on the buttons. Is this possible?

 

Parents
  • 44743
    posted

    You can try to use the MouseEnterElement event on the toolbars manager and get the context of the entered element to see if it was a tool:

    ToolBase enteredTool = (ToolBase)e.Element.GetContext( typeof( ToolBase ), false );

    if ( enteredTool != null )
    {
     // ...
    }

    However, this will not work if you are dragging from a control which takes capture of the mouse when the mouse button is down. If that is the case, you would need to find the tool under the mouse in the mouse move of the control dragged from:

    private void button1_MouseMove( object sender, MouseEventArgs e )
    {
     Point screenLocationOfMouse = this.button1.PointToScreen( e.Location );
     ToolBase toolUnderMouse = this.ultraToolbarsManager1.ToolFromPoint( screenLocationOfMouse );

     if ( toolUnderMouse != null )
     {
      // ...
     }
    }

Reply Children