How can I get a text from textinput only knowing the id?
-
- Posts: 18
- Joined: Sat Nov 17, 2007 11:34 am
How can I get a text from textinput only knowing the id?
Okay... so I have the id of a gadget in a int
Is there a way to get a pointer to a gadget by the id or anyother way to find out what is in the textinput just by knowing the id?
Is there a way to get a pointer to a gadget by the id or anyother way to find out what is in the textinput just by knowing the id?
Re: How can I get a text from textinput only knowing the id?
((gui::IGUIEditBox*)getElementFromId(YOUR_ID, true))->getText();sanctus2099 wrote:Okay... so I have the id of a gadget in a int
Is there a way to get a pointer to a gadget by the id or anyother way to find out what is in the textinput just by knowing the id?
getRootGUIElement() also may be of interest for you, if you don't have a IGUIWindow where your Editbox is placed. Just search the docs.
-
- Posts: 18
- Joined: Sat Nov 17, 2007 11:34 am
Yes, there is such a function.
You can use Google, can't you?
http://irrlicht.sourceforge.net/docu/cl ... nt.html#a6
You can use Google, can't you?
http://irrlicht.sourceforge.net/docu/cl ... nt.html#a6
-
- Posts: 18
- Joined: Sat Nov 17, 2007 11:34 am
right, always search the forum first !!!
well, just in case you're to dump to do a search
try this thread: http://irrlicht.sourceforge.net/phpBB2/ ... rt+convert
but seriously, please search the forums before asking, it usualy will save a lot of time for all of us !!!
well, just in case you're to dump to do a search
try this thread: http://irrlicht.sourceforge.net/phpBB2/ ... rt+convert
but seriously, please search the forums before asking, it usualy will save a lot of time for all of us !!!
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 18
- Joined: Sat Nov 17, 2007 11:34 am
Okay... my bad... I did look a litle into the search but didn't find exactly what I wanted... its ok now... next problem...
It does compile... but when it passes those lines it breaks and says something about it not beeing defined... could someone please recode that small thing? pls
Code: Select all
IGUIElement* elem;
char temp[255];
wcstombs(temp, elem->getElementFromId(nameid)->getText(), 255);
Always funny when people try to summarize error messages instead of just pasting them :-) That exact (and complete!) error message is the thing we need to help you ...sanctus2099 wrote: ... but when it passes those lines it breaks and says something about it not beeing defined...
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
right, because IGUIElement* elem; is undefined garbage and you try to get an element from it...
so changetoor whatever your gui environment is defined in...
so change
Code: Select all
elem->getElementFromId(nameid)->getText()
Code: Select all
guienv->getElementFromId(nameid)->getText()
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Posts: 18
- Joined: Sat Nov 17, 2007 11:34 am
Code: Select all
c:\SanctusOnline\IntfFunctions.cpp(21): error C2039: 'getElementFromId' : is not a member of 'irr::gui::IGUIEnvironment'
c:\SanctusOnline\Irrlicht\IGUIEnvironment.h(55) : see declaration of 'irr::gui::IGUIEnvironment'
ohh, my fault, I just looked at your code and made a quick post...sanctus2099 wrote:I allready tryed that. Is there a way to get the masterparent of all gui elements?
but why you didn't simply look at the api, it's a realy magical file that tells you all about Irrlicht's elements and their functions !!!
so the code must (of course) be:
Code: Select all
guienv->getRootGUIElement()->getElementFromId(nameid)->getText()
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
You're forgetting that you need to tell the call to recursively traverse the element graph...
Travis
Code: Select all
gui::IGUIElement* found = gui->getRootElement()->getElementFromId(id, true);
if (found)
{
const wchar_t* wstr = found->getText();
}