Disabling Treeview Nodes
-
- Posts: 8
- Joined: Sat Apr 19, 2014 9:51 pm
Disabling Treeview Nodes
Ok so i understand how to setup treeviews and adding nodes to them. but what i am trying to figure out is how do i disable the selection of nodes beneth the child of the root node. any suggestions?
Re: Disabling Treeview Nodes
I don't think that's supported. You'd have to copy the code and modify it for an own element which can do that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: Disabling Treeview Nodes
The non-hack way: You create a top element of the TreeView (and of the same dimensions as the TreeView) that intercepts the mouse click events. Find out if the user is clicking a disabled node, and if not, call the OnEvent of the TreeView child node with the passed parameters.
It's somewhat tricky. You have to make sure that your top element is the first child and is always returned to the top (and the focus when necessary). I haven't tried it with TreeView specifically, so it may not work.
There's an example of such a top element (though not with TreeView) in the example GUI elements. I wish I could remember which one...
It's somewhat tricky. You have to make sure that your top element is the first child and is always returned to the top (and the focus when necessary). I haven't tried it with TreeView specifically, so it may not work.
There's an example of such a top element (though not with TreeView) in the example GUI elements. I wish I could remember which one...