How can I get a text from textinput only knowing the id?

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.
shogun
Posts: 162
Joined: Wed Sep 05, 2007 11:02 am
Location: inside

Post 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?
sanctus2099
Posts: 18
Joined: Sat Nov 17, 2007 11:34 am

Post 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??
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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.
sanctus2099
Posts: 18
Joined: Sat Nov 17, 2007 11:34 am

Post by sanctus2099 »

Oh but I did read the posts...
Every element has the parent the element returned my MASTERPARENT()
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post 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 :-)
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
Post Reply