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.

Why do Buttons not work?

Postby Notion » Tue Jun 27, 2017 2:50 pm

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

cpp 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?
Notion
 
Posts: 9
Joined: Mon Mar 20, 2017 11:00 pm

Re: Why do Buttons not work?

Postby CuteAlien » Tue Jun 27, 2017 3:10 pm

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.freenode.net
Code snippets, patches&stuff: http://www.michaelzeilfelder.de/irrlicht.htm
Free racer created with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
User avatar
CuteAlien
Admin
 
Posts: 8362
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany

Re: Why do Buttons not work?

Postby Notion » Tue Jun 27, 2017 4:25 pm

Oh, thanks a lot, that actually was the case, works fine now!
Notion
 
Posts: 9
Joined: Mon Mar 20, 2017 11:00 pm


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest