Why do Buttons not work?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Notion
Posts: 9
Joined: Mon Mar 20, 2017 11:00 pm

Why do Buttons not work?

Post by Notion »

I added polling for button events to the MastEventController, basically like that:

Code: Select all

        if (event.EventType == EET_GUI_EVENT)
        {
 
            s32 id = event.GUIEvent.Caller->getID();
 
            switch (event.GUIEvent.EventType)
            {
            case EGET_BUTTON_CLICKED:
                if (id == 1)
                {
                    
                }
                break;
 
            }
        }
It wont enter the if block though, couldnt figure out why, do I miss something?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Why do Buttons not work?

Post by CuteAlien »

Depends on which block it won't enter (the id == 1 obviously only works when you got an id with that number).
But most likely reason - you return true in your event-receiver for mouse-events. Which tells Irrlicht that those events are handled by yourself and won't be passed on the GUI at all. Always return false by default in your event-receiver.
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
Notion
Posts: 9
Joined: Mon Mar 20, 2017 11:00 pm

Re: Why do Buttons not work?

Post by Notion »

Oh, thanks a lot, that actually was the case, works fine now!
Post Reply