1 Reply Latest reply on Aug 30, 2016 8:25 AM by Patrick.Cashman

    How to Detach the mouse events.

    15e6ad19-6d34-8b46-0100-014f0327e866

      Hello all,

      I have developed a small script in vb .net which reads the mouse coordinates and draws a DRC window.I want to remove the mouse event if i selected different option ,how can this be acheived i  am just adding the piece of code which i developed.Please help me in this regard.

       

       

      Thanks & Regards,

      Bharadwaj

        • 1. Re: How to Detach the mouse events.
          Patrick.Cashman

          Declare a public mode variable.

          Set mode = on in the button click subroutine.

          Set mode = off a the end of the mousedrag function

          Check if mode is on at the beginning of the mousedrag function; exit if mode = off.

           

          Or some variation of that.

           

          In this way, the mode is only on when you click the button.  As soon as the click and drag action is done, it turns itself off until the button is clicked again.

           

          There may be some better way of doing it by setting the mouseDrag commandlistener to nothing. You might want to experiment with that as well.  There may be a performance benefit depending on the persistence of the mouseDrag listener. Perhaps activate the commandlistener in the buttonclick routine then kill it at the end of the mousedrag function.