Profile Picture

NTreeViewEx - Cancel expand/collapse

Posted By Imanol Yurrebaso 11 Years Ago
Author
Message
Imanol Yurrebaso
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 15, Visits: 3
Hello,

In my NTreeViewEx, I capture the double click event and perform a certain operation with the text of that node. Additionally, following the behaviour of the NTreeViewEx, the node will collapse or expand depending on the previous state. I would like to avoid that behaviour, but still allowing the user to expand or collapse the nodes by using the +/- symbol.

I managed to capture the collapsing/collapsed/expanding/expanded events with the ItemNotify event, but I cannot find the way of cancelling the action. Any ideas?

PS: as I asked some questions here already and received good replies, I would like to thank the wonderful work of the Nevron Support Team .

Nevron Support
Posted 11 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Last Week
Posts: 3,054, Visits: 4,009
Hi Imanol,

Try to handle ItemNotify event as in following example code:

bool m_Clicked;

      void nTreeViewEx1_ItemNotify(object sender, NLightUIItemNotifyData data)
      {
         if (data.NotifyCode == NTreeViewEx.ItemLabelClickNotifyCode)
         {
            m_Clicked = true;
         }
                  
         if (data.NotifyCode == NTreeViewEx.NodeExpandingNotifyCode || data.NotifyCode == NTreeViewEx.NodeCollapsingNotifyCode)
         {
            if (m_Clicked)
            {
               data.Cancel = true;
               m_Clicked = false;
            }            
         }         
      }

Best Regards,
Nevron Support Team



Imanol Yurrebaso
Posted 11 Years Ago
View Quick Profile
Junior Member

Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)Junior Member (15 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 15, Visits: 3
Thanks, I managed to use that in my code .



Similar Topics


Reading This Topic