Click on Treelist Subitems


Author
Message
Angel Chorbadzhiev
Angel Chorbadzhiev
Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)Supreme Being (142 reputation)
Group: Forum Members
Posts: 139, Visits: 184

Hello Dieter,

You can get the subitem of NTreeList when the user click on it by the following way:

//Attach to MouseUp event

nTreeList1.MouseUp += new MouseEventHandler(nTreeList1_MouseUp);

...

void nTreeList1_MouseUp(object sender, MouseEventArgs e)

{

    NTreeListNode node = (NTreeListNode)nTreeList1.ItemFromPoint(new NPoint(e.Location));

    for (int i = 0; i < node.SubItems.Count; i++)

    {

        Rectangle r = node.SubItems[i].ViewBounds.ToRectangle();

        if (r.Contains(e.Location))

        {

            subItem = node.SubItems[i];

            return;

        }

    }

}

 

Regards,

Angel.


Dieter Spiegel
Dieter Spiegel
Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)Forum Newbie (9 reputation)
Group: Forum Members
Posts: 9, Visits: 1
Is there an easy way in the treelist to get the subitem that the user clicked on? I can get the selected item, but have problems retrieving the subitem.

Thanks

Dieter

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