I've got a window created as this:
gui::IGUIWindow* window = env->addWindow(core::rect<s32>(220, 180, 420, 300), false, L"Connect to...", 0, 101);
env->addStaticText(L"IP address:", core::rect<s32>(10,30,90,50),false, false, window);
env->addEditBox(L"000.000.000.000", core::rect<s32>(80,30,190,50), true, window, 102);
env->addStaticText(L"port:", core::rect<s32>(10,60,90,80),false, false, window);
env->addEditBox(L"80", core::rect<s32>(80,60,190,80), true, window, 103);
env->addButton(core::rect<s32>(10,90,190,110), window, 104, L"Connect!");
(the env variable has been declared as: env = device->getGUIEnvironment(); device has been initialized, etc. )
It compiles correctly, but when executed, I can't type anythig inside the edit boxes. I can delete the contents just fine, using either BACKSPACE or SUPR, but can't write any new character.
Note: i'm compiling under linux mandrake 9.2
Please, help.
problem with Edit Boxes
fix for linux key input
not sure if this is the best way to do it, but it works for me:
CIrrDeviceLinux.h DIFF:
228a230,232
> bool shiftKeyActive;
> bool controlKeyActive;
> bool altKeyActive;
CIrrDeviceLinux.cpp DIFF:
73a74,76
> shiftKeyActive = false;
> controlKeyActive = false;
> altKeyActive = false;
440a445,474
> // if one of the modifiers (shift/control) is pressed, just update the status flag
> if(mp.X11Key == XK_Shift_L || mp.X11Key == XK_Shift_R)
> {
> shiftKeyActive = !shiftKeyActive;
> break;
> }
> if(mp.X11Key == XK_Control_L || mp.X11Key == XK_Control_R)
> {
> controlKeyActive = !controlKeyActive;
> break;
> }
> if(mp.X11Key == XK_Alt_L || mp.X11Key == XK_Alt_R)
> {
> altKeyActive = !altKeyActive;
> break;
> }
>
> // change keyvalue depending on shift/control flags
> if(mp.X11Key >= XK_a && mp.X11Key <= XK_z)
> {
> if(shiftKeyActive)
> {
> mp.X11Key -= 32;
> }
> if(controlKeyActive)
> {
> mp.X11Key -= 96;
> }
> }
>
448,450c482,484
< irrevent.KeyInput.Char = mp.X11Key; // TODO: find right character
< irrevent.KeyInput.Control = false; // TODO
< irrevent.KeyInput.Char = false; // TODO
---
> irrevent.KeyInput.Char = mp.X11Key;
> irrevent.KeyInput.Control = controlKeyActive;
> irrevent.KeyInput.Shift = shiftKeyActive;
edit: better version that also captures the alt-key so alt-f4 now works within linux, too and the error message "no win32 key found" is gone.
CIrrDeviceLinux.h DIFF:
228a230,232
> bool shiftKeyActive;
> bool controlKeyActive;
> bool altKeyActive;
CIrrDeviceLinux.cpp DIFF:
73a74,76
> shiftKeyActive = false;
> controlKeyActive = false;
> altKeyActive = false;
440a445,474
> // if one of the modifiers (shift/control) is pressed, just update the status flag
> if(mp.X11Key == XK_Shift_L || mp.X11Key == XK_Shift_R)
> {
> shiftKeyActive = !shiftKeyActive;
> break;
> }
> if(mp.X11Key == XK_Control_L || mp.X11Key == XK_Control_R)
> {
> controlKeyActive = !controlKeyActive;
> break;
> }
> if(mp.X11Key == XK_Alt_L || mp.X11Key == XK_Alt_R)
> {
> altKeyActive = !altKeyActive;
> break;
> }
>
> // change keyvalue depending on shift/control flags
> if(mp.X11Key >= XK_a && mp.X11Key <= XK_z)
> {
> if(shiftKeyActive)
> {
> mp.X11Key -= 32;
> }
> if(controlKeyActive)
> {
> mp.X11Key -= 96;
> }
> }
>
448,450c482,484
< irrevent.KeyInput.Char = mp.X11Key; // TODO: find right character
< irrevent.KeyInput.Control = false; // TODO
< irrevent.KeyInput.Char = false; // TODO
---
> irrevent.KeyInput.Char = mp.X11Key;
> irrevent.KeyInput.Control = controlKeyActive;
> irrevent.KeyInput.Shift = shiftKeyActive;
edit: better version that also captures the alt-key so alt-f4 now works within linux, too and the error message "no win32 key found" is gone.