Profile Picture

Trying to add button to an NTreeListNode subitem

Posted By lars knox 14 Years Ago
Author
Message
Nevron Support
Posted 14 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 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
Posted 14 Years Ago
View Quick Profile
Junior Member

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
Last Active: 13 Years Ago
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!

 





Similar Topics


Reading This Topic