Page 2 of 2

Posted: Tue Nov 27, 2007 9:57 am
by shogun
Is there a way to get the masterparent of all gui elements?
I gave you a hint right in my first post. Can't you read or something?

Posted: Wed Nov 28, 2007 2:38 pm
by sanctus2099
Okay... sorry didn't read the first post again...
but I have this code:

Code: Select all

IGUIElement* elem = game.INTF()->MASTERPARENT();
		IGUIElement* elem2 = elem->getElementFromId(nameid);
MASTERPARENT() returns getRootElement()

I lookd into the watch and elem has a good value.
elem2 however doesn't.
I don't get it... nameid has 106 code. And there is a textinput with 106 code entered. Is there any bug? am I not using it correctly??

Posted: Wed Nov 28, 2007 3:33 pm
by vitek
You are definitely not reading posts. Unless the text box is a direct child of the root scene node, my previous post in this topic explains exactly why your code doesn't work.

Posted: Wed Nov 28, 2007 3:45 pm
by sanctus2099
Oh but I did read the posts...
Every element has the parent the element returned my MASTERPARENT()

Posted: Wed Nov 28, 2007 5:07 pm
by CuteAlien
Just to be sure you still could try setting the second parameter to true like Vitek proposed. But I would rather suspect your game object, your INTF() function or your MASTERPARENT() function as I know about none of those.

When searching for bugs you should try to reduce the problem to the minimum before looking for help from others. There are obviously still a few layers of code which you don't post here and so we are all guessing around.

Try to reduce your problem to a short problem which you can post here completly. There's always a good chance you find the bug yourself while doing so :-)