Page 1 of 1

MessageBox

Posted: Tue Jun 28, 2011 6:19 pm
by cooky451
Hi,

is there a way to show a window, like the Windows "MessageBox()"? The only way I found was:
(from tutorial code)

Code: Select all

IGUIWindow* window = env->addWindow(
						rect<s32>(100 + Context.counter, 100 + Context.counter, 300 + Context.counter, 200 + Context.counter),
						false, // modal?
						L"Test window");

					env->addStaticText(L"Please close me",
						rect<s32>(35,35,140,50),
						true, // border?
						false, // wordwrap?
						window);
Which needs a IGUIEnvironment* and doesn't take the focus. Is there a way to show a "free" message box which takes the focus?
How do you show your error messages, e.g. "Could not create device."?

Posted: Tue Jun 28, 2011 7:19 pm
by nespa
see CGUIMessageBox in Irrlicht source

Posted: Tue Jun 28, 2011 7:39 pm
by cooky451
nespa wrote:see CGUIMessageBox in Irrlicht source
Can't find that. Is CGUIMessageBox declared in irr::gui? Could you post a docu-link, or show me some example how to use?

Edit:
Ok, I found:

Code: Select all

Device->getGUIEnvironment()->addMessageBox(
                Caption.c_str(), MessageText.c_str());
But this still needs a device createt. Is there a way to show a message box without creating a device?

Posted: Tue Jun 28, 2011 8:06 pm
by CuteAlien
The gui-environment has a function addMessageBox
See documentation: http://irrlicht.sourceforge.net/docu/cl ... 728098a917

Posted: Tue Jun 28, 2011 8:09 pm
by cooky451
CuteAlien wrote:The gui-environment has a function addMessageBox
See documentation: http://irrlicht.sourceforge.net/docu/cl ... 728098a917
Thanks for helping me, but I found it just right now. (See edit of post above)
cooky451 wrote:But this still needs a device createt. Is there a way to show a message box without creating a device?

Posted: Wed Jun 29, 2011 7:12 am
by CuteAlien
No, everything in Irrlicht needs a device. Otherwise we couldn't know how to draw the MessageBox (which is using the Irrlicht GUI).