Right-click changes selected node

8 posts, 0 answers
  1. Troy
    Troy avatar
    11 posts
    Member since:
    Apr 2009

    Posted 23 Aug 2010 Link to this post

    In another forum post, it was implied that right-clicking on a tree node did not change the selected node (and fire SelectedNodeChanged) but it appears that in my TreeView is does.

    Is there any way to disable this behavior?  I am using the right-click to launch a context menu but do not want the selected node to change.

    I'm not using multiselect.
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 25 Aug 2010 Link to this post

    The tree view doesn't react on the right mouse click. Are you changing the node.checked property in anything like the SelectedNodeChanging event?

    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Troy
    Troy avatar
    11 posts
    Member since:
    Apr 2009

    Posted 25 Aug 2010 Link to this post

    No, I'm not using SelectedNodeChanging at all.  I am using ContextMenuShowing but all I do there is set a variable to the clicked node.

    When I right-click on any tree node, SelectedNodeChanged fires, followed by ContextMenuShowing.  The only other events I'm using are some of the drag/drop events, none of which fire on right-click.

    I'm using version 2010.1.10.504.
  5. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 27 Aug 2010 Link to this post

    Hello everyone,

    Thank you for writing.

    At the moment RadTreeView changes its selection on mouse right-click and shows the context menu of the selected node. This behavior is not quite right and our team would like to apologize for the caused inconvenience.

    I would like to let you know that we decided to create a brand new RadTreeView control designed to replace and extend the functionality of its ancestor. It will introduce new  features, greater flexibility, and better performance. For example, one exciting improvement of the new control will be virtualization, which will allow you to load a great number of nodes without any performance concerns. More importantly, it will address all issues introduced in the current RadTreeView including the one you are experiencing. This control is part of our road map and although we cannot guarantee it, we will do our best to introduce it in Q3 2010.

    At the moment, the only workaround I can suggest is illustrated in the attached sample project. I hope you will find it useful.

    Let me know if I can assist you further.

    All the best,
    Boryana
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Sonya L
    Sonya L avatar
    36 posts
    Member since:
    Dec 2009

    Posted 24 May 2011 Link to this post

    It looks like this solution no longer works for 2011 Q1 SP1, since SelectedIndexChanging/Changed fires before MouseDown and NodeMouseDown.  How can I accomplish this in the new version of the controls?  Thanks!
  7. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 25 May 2011 Link to this post

    Hi Sonya L,

    Thank you for writing.

    The latest version of our controls allows the implementation of the original scenario suggested in the forum thread. The attached sample project illustrates how to show a context menu for every right-clicked node without changing the selection. Please note that in order to show a context menu for a non-selected node, you will need to assign a custom menu. For further details please refer to the attached file.

    Let me know if I can assist you further.

    Best wishes,
    Boryana
    the Telerik team
    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
  8. Sonya L
    Sonya L avatar
    36 posts
    Member since:
    Dec 2009

    Posted 25 May 2011 Link to this post

    Is there a way to use this solution, and also have ContextMenuOpening fire?  I'm using ContextMenuOpening to save the node that is right-clicked, and also to set some properties of the context menu (disabling menu options for certain nodes, etc).  With this solution, ContextMenuOpening does not fire if the node is not selected when you right-click on it.  Thanks for your help!
  9. Boryana
    Admin
    Boryana avatar
    330 posts

    Posted 31 May 2011 Link to this post

    Hello Sonya L,

    Thanks for writing back.

    The ContextMenuOpening event will fire only for selected nodes. In this sense you will not be able to use this event for the context menu of the non-selected nodes. I would recommend creating a custom context menu in an extended RadTreeView class. This context menu will be shown for both selected and non-selected nodes. You will also be able to get the right-clicked node in the extended implementations.

    Please refer to a modified version of the sample project. If you have additional questions, feel free to contact me.

    Kind regards,

    Boryana
    the Telerik team

     

    Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Back to Top
UI for WinForms is Visual Studio 2017 Ready