Trying to add button to an NTreeListNode subitem


Author
Message
Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K

Hi Lars,

You can use NTreeListNodeImageSubItem to display an image to a subitem.

To handle the click event you should attach to ItemNotify event as in the example code below:

NTreeListColumn column = new NTreeListColumn();
nTreeList1.Columns.Add(column);

NTreeListNode node = new NTreeListNode();
NTreeListNodeImageSubItem imageSubItem = new NTreeListNodeImageSubItem();

imageSubItem.Image = myImage
;
imageSubItem.Column = column;
node.SubItems.Add(imageSubItem);
nTreeList1.Nodes.Add(node);

nTreeList1.ItemNotify +=
new NLightUIItemNotifyEventHandler(nTreeList1_ItemNotify);

...

void nTreeList1_ItemNotify(object sender, NLightUIItemNotifyData data)
{
    if (data.NotifyCode == NTreeList.ItemLabelClickNotifyCode)
    {
        NTreeListNode currentNode = (NTreeListNode)data.Sender;
        NTreeListNodeImageSubItem clickedItem = (NTreeListNodeImageSubItem)currentNode.ResolveSubItem(nTreeList1.Columns[0]);
    }
}

The only drawback here is that you can't determine on which sub item exactly is clicked if you do not know the item's column.

 

 

 



Best Regards,
Nevron Support Team


lars knox
lars knox
Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)Junior Member (22 reputation)
Group: Forum Members
Posts: 22, Visits: 1

Hi,

I'm trying to add a command button (or NButton or anything else that can act like a button and display an image) to a subitem of an NTreeListNode.

I've been searching the forum and perusing the documentation but haven't been able to find any answers yet.

Do you have a snippet of code that could show how this is done please? Thanks!

 


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search