Disable Mouse Click Event

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • selvakumari
    New Member
    • Feb 2008
    • 14

    Disable Mouse Click Event

    Hi,

    i am new to C#,

    i have a multiselection treeview, where if i select a nodes with ctrl and shift corresponding nodes will be copied to another treenode,

    i want to unselect the childnode selection with ctrl and shift if parent node is selected.

    i think of disablin the mouse click event inside that treenode if parent node is selected?
    [code=c]
    private void treeViewMS1_Aft erSelect(object sender, TreeViewEventAr gs e)
    {
    MyKeyEvent kEv = new MyKeyEvent();
    bool kControl2 = (ModifierKeys == Keys.Control);
    bool kShift2 = (ModifierKeys == Keys.Shift);
    bool mClick = (MouseButtons == MouseButtons.Le ft);
    // bool parent =IsP
    if (e.Node.Text == "WeldDataFi le")
    {
    if ((kControl2) && (mClick))
    {
    // OnKeyAction(thi s, kEv);
    //Here i have to disable mouse event till i copy that selected node to another treeview
    }
    else if ((kShift2) && (mClick))
    {
    //OnKeyAction(thi s, kEv);
    //Here i have to disable mouse event till i copy that selected node to another treeview
    }
    }
    }
    [/code]

    Can anybody plz help me in this regards, its urgent
    Last edited by SammyB; Feb 29 '08, 07:16 PM. Reason: Add Code tags
  • SammyB
    Recognized Expert Contributor
    • Mar 2007
    • 807

    #2
    The easy way is to have a class-level variable that is set to true while you copy the node. Then you just check that variable in other events. The fancy way is to filter out the mouse messages before they reach the controls. If you google for IMessageFilter and mouse, you will find code examples. HTH --Sam

    Comment

    • selvakumari
      New Member
      • Feb 2008
      • 14

      #3
      Originally posted by SammyB
      The easy way is to have a class-level variable that is set to true while you copy the node. Then you just check that variable in other events. The fancy way is to filter out the mouse messages before they reach the controls. If you google for IMessageFilter and mouse, you will find code examples. HTH --Sam

      i used IMessage filter interface but mouse is disabled in the whole application, but i want it only inside treeview
      how come it is possible?

      Comment

      Working...