What didn't work? Was the value printed by the fprintf call all goobered up? It might also be important to know what platform/compiler you are using.
It might be in your best interest to write a short test case to illustrate the problem and post the code here. I am still not convinced that you are not shooting yourself in the foot. Maybe you could just provide a bit more of your code so we can find what is going on.
Here is a complete testcase that shows the edit control does work, at least on my machine. Hopefully it will show you that the edit box is not the problem.
Code: Select all
#include <irrlicht/irrlicht.h>
#pragma comment(lib, "irrlicht.lib")
using namespace irr;
using namespace gui;
class MyEventReceiver : public IEventReceiver
{
public:
MyEventReceiver()
{
}
virtual bool OnEvent(SEvent event)
{
if (event.EventType == EET_LOG_TEXT_EVENT)
{
fprintf(stderr, "%u: %s\n", event.LogEvent.Level, event.LogEvent.Text);
return true;
}
else if (event.EventType == irr::EET_GUI_EVENT && event.GUIEvent.EventType == EGET_EDITBOX_ENTER)
{
fprintf(stderr, "%s\n", core::stringc(event.GUIEvent.Caller->getText()).c_str());
return true;
}
return false;
}
};
int main(int argc, char* argv[])
{
// event receiver displays the edit box text
MyEventReceiver receiver;
// create device and exit if creation failed
IrrlichtDevice* device
= createDevice(video::EDT_SOFTWARE, core::dimension2d<s32>(800, 600), 16, false, false, false, &receiver);
if (!device)
return 1; // could not create selected driver.
// get the gui manager
IGUIEnvironment* gui = device->getGUIEnvironment();
// create a single edit box
gui->addEditBox(L"", core::rect<s32>(10, 10, 300, 30));
// get the driver so we can go on with our lives
video::IVideoDriver* driver = device->getVideoDriver();
while(device->run() && driver)
{
// try to draw everything
if (driver->beginScene(true, true, video::SColor(255, 0, 0, 0)))
{
// render a full screen size image
gui->drawAll();
// end the scene
driver->endScene();
}
}
// release everything
device->drop();
return 0;
}