Nevron Forum

Events in NTreeListNode with ContextMenu

https://www.nevron.com/Forum/Topic3553.aspx

By Fabian Baptista 1 - Wednesday, May 19, 2010

Hi, I'm using NTreeList, with NTreeNodes.
Each NTreeNode has a NContextMenu.

But, when CommandClick Event is fired, I don't know who was the Node "selected", since right click doesn't select any node.

How can I do this?
Thanks in advance
Fabián
By Angel Chorbadzhiev - Thursday, May 20, 2010

Hi Fabian,

You can get the node that context menu belongs to, by previously save reference to it in the event handler of NTreeLiset.ItemNotify event:  

NTreeListNode m_CurrentNode;

...

nTreeList1.ItemNotify += new NLightUIItemNotifyEventHandler(nTreeList1_ItemNotify);

...

void nTreeList1_ItemNotify(object sender, NLightUIItemNotifyData data)

{

    if (data.NotifyCode == NTreeList.ItemContextMenuDisplayingNotifyCode)

    {

        m_CurrentNode = (NTreeListNode)data.Sender;

    }

}

 

Then, when CommandClick event fires in the event handler you can use this cashed node.

Regards,

Angel.

By Fabian Baptista 1 - Saturday, May 22, 2010

Caching node works!
Thanks one more time Angel.