[fixed]Modal + checkbox, click checkbox, window blinks

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.

[fixed]Modal + checkbox, click checkbox, window blinks

Postby yaten » Thu Dec 16, 2010 11:08 am

I have encountered something weird, I'm not sure if this is a bug, but would like to ask others for opinion.

This is how it goes:
I created a window of type Modal, then placed a checkbox on it. If you click the checkbox, the whole window blinks, as if you are being reminded that you have a modal window still open so you cannot click other places except the Modal window. But the checkbox is at the Modal window, so in my opinion it should NOT be blinking, unless I didn't understand that right ^_^

Take the example program "05.UserInterface"

at the part:
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");


just make it 'true' to make the window Modal.

Then simply add a checkbox:
Code: Select all
bool sw = false;
env->addCheckBox(sw, core::rect<int>(35,10,140,50),
window, 1, L"Sample Checkbox");



or simply copy and paste this slightly condensed version of the UserInterface sample program:

Code: Select all
#include <irrlicht.h>
#include "driverChoice.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
struct SAppContext
{
   IrrlichtDevice *device;
   s32            counter;
   IGUIListBox*   listbox;
};
enum
{
   GUI_ID_QUIT_BUTTON = 101,
   GUI_ID_NEW_WINDOW_BUTTON,
   GUI_ID_FILE_OPEN_BUTTON,
   GUI_ID_TRANSPARENCY_SCROLL_BAR
};
class MyEventReceiver : public IEventReceiver
{
public:
   MyEventReceiver(SAppContext & context) : Context(context) { }
   virtual bool OnEvent(const SEvent& event)
   {
      if (event.EventType == EET_GUI_EVENT)
      {
         s32 id = event.GUIEvent.Caller->getID();
         IGUIEnvironment* env = Context.device->getGUIEnvironment();
         switch(event.GUIEvent.EventType)
         {
         case EGET_BUTTON_CLICKED:
            switch(id)
            {
            case GUI_ID_NEW_WINDOW_BUTTON:
               {
               Context.listbox->addItem(L"Window created");
               Context.counter += 30;
               if (Context.counter > 200)
                  Context.counter = 0;
               IGUIWindow* window = env->addWindow(
                  rect<s32>(100 + Context.counter, 100 + Context.counter, 300 + Context.counter, 200 + Context.counter),
                  true, // modal?
                  L"Test window");
               bool sw = false;
               env->addCheckBox(sw, core::rect<int>(35,10,140,50),
               window, 1, L"Sample Checkbox");
               }
               return true;
            default:
               return false;
            }
            break;
         default:
            break;
         }
      }
      return false;
   }
private:
   SAppContext & Context;
};

int main()
{
   video::E_DRIVER_TYPE driverType=driverChoiceConsole();
   if (driverType==video::EDT_COUNT)
      return 1;
   IrrlichtDevice * device = createDevice(driverType, core::dimension2d<u32>(640, 480));
   if (device == 0) return 1;
   device->setWindowCaption(L"Irrlicht Engine - User Interface Demo");
   device->setResizable(true);
   video::IVideoDriver* driver = device->getVideoDriver();
   IGUIEnvironment* env = device->getGUIEnvironment();
   IGUISkin* skin = env->getSkin();
   IGUIFont* font = env->getFont("../../media/fonthaettenschweiler.bmp");
   if (font)
      skin->setFont(font);
   env->addButton(rect<s32>(10,280,110,280 + 32), 0, GUI_ID_NEW_WINDOW_BUTTON,
         L"New Window", L"Launches a new Window");
   IGUIListBox * listbox = env->addListBox(rect<s32>(50, 140, 250, 210));
   SAppContext context;
   context.device = device;
   context.counter = 0;
   context.listbox = listbox;
   MyEventReceiver receiver(context);
   device->setEventReceiver(&receiver);
   while(device->run() && driver)
   if (device->isWindowActive())
   {
      driver->beginScene(true, true, SColor(0,200,200,200));
      env->drawAll();
      driver->endScene();
   }
   device->drop();
   return 0;
}


run the program, click new window, the window will appear, a modal type window, click the checkbox and see the window blinking. Is that a bug? Its not really a big deal, I could live with that ^_^ I just want to make sure the the cause of it isn't because of my ignorance. ^_^
User avatar
yaten
 
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia

Postby CuteAlien » Thu Dec 16, 2010 12:32 pm

Thanks, that sounds like a bug.
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5358
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Postby yaten » Thu Dec 16, 2010 8:31 pm

CuteAlien wrote:Thanks, that sounds like a bug.

No problem sir, I'm glad it helped even if just a little. I'd really like to contribute something to this great project, but I'm not an expert. So I could only try to report bugs and evangelize the use of this Engine. ^_^
User avatar
yaten
 
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia

Postby CuteAlien » Fri Dec 17, 2010 12:16 am

Fixed it in svn release branch 1.7, svn trunk will follow soon as usual.

I also changed that modalscreens now prefer giving focus to their first child instead of taking it themself as that lead to dialogs losing the focus all the time.

Thanks also for the nice testcase :-)
IRC: #irrlicht on irc.freenode.net
My patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Games with Irrlicht: http://www.irrgheist.com/
News: http://www.reddit.com/r/irrlicht/
User avatar
CuteAlien
Admin
 
Posts: 5358
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Postby yaten » Fri Dec 17, 2010 6:19 pm

Wow that was fast! Thanks sir ^_^
User avatar
yaten
 
Posts: 41
Joined: Tue Nov 16, 2010 4:57 pm
Location: /home/yaten on a server somewhere East of Asia


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 0 guests