Disabling Treeview Nodes

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
alexescamilla
Posts: 8
Joined: Sat Apr 19, 2014 9:51 pm

Disabling Treeview Nodes

Post by alexescamilla »

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?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Disabling Treeview Nodes

Post by CuteAlien »

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
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: Disabling Treeview Nodes

Post by chronologicaldot »

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...
Post Reply