Get GUIElement from IGUIEnvironment

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
Morgawr
Posts: 95
Joined: Wed Sep 26, 2007 7:04 pm

Get GUIElement from IGUIEnvironment

Post by Morgawr »

Hello everyone... Is there a way to get a GUIElement (e.g. a button) previously stored inside the Enviroment with env->addButton(etcetc); without having it saved inside a button object? Just by passing the ID of the said button to the IGUIEnvironment.

something like button=env->getElement(ID);??
A function like this would be really useful and I'm not sure if it's already there... my problem is that I have a function that loads and sets the environment without using variables to store the information, manually adding them directly to the environment but, if I want to use them later -to make them visible or invisible for example- I can't access to them...

I wouldn't like to save those elements inside variables because they will make my code pretty "heavy" and I'd like to make it as much generalized as possible.. Thanks for you help :roll:
CuteAlien
Admin
Posts: 9971
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

env->getRootGUIElement ()->getElementFromId (s32 id, bool searchchildren);
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
Morgawr
Posts: 95
Joined: Wed Sep 26, 2007 7:04 pm

Post by Morgawr »

CuteAlien wrote:env->getRootGUIElement ()->getElementFromId (s32 id, bool searchchildren);
Whoa thanks a lot! Fastest reply ever! That's just what I was looking for! :oops: :lol:
Post Reply