EGET_ELEMENT_HOVERED only on titlebar?

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
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

EGET_ELEMENT_HOVERED only on titlebar?

Post by instinct »

Is it true that this GUI EventType is only detected when the mousecursor hovers over the titlebar of the IGUIElement? Same goes for EGET_ELEMENT_LEFT.

If there is a way to change this to detection when the mousecursor is inside the rectangle of the element that would be nice :) I dont want my camera to rotate when the user has his mousecursor inside a window ;) The way it is now, he has to hover over the titlebar first. It is possible that user enters the rectangle of the window from the bottom.

Am i trying to do this the correct way or am i being stupid as usual :P Is there any other approach on achieving what i want?
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

i second this request. it's because when i'm pressing a GUI element in my scene editor (dragging window/pressing button etc.) it automatically selected the scene node which is behind the element. :cry:
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Works for me in SVN. Can you show an example using minimal code?

Do you have another GUI element inside the window, and this gets the hover event instead?
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

now i can get EGET_ELEMENT_HOVERED to work but not EGET_ELEMENT_LEFT

in event receiver class,

Code: Select all

case EGET_ELEMENT_HOVERED:
                {
                    cursorUnderGUI = true;
                }
                break;
                case EGET_ELEMENT_LEFT:
                {
                    cursorUnderGUI = false;
                }

Code: Select all

if (smgr->getActiveCamera() == camera && cursorUnderGUI == false)
    {
        selectedNode = smgr->getSceneCollisionManager()->getSceneNodeFromScreenCoordinatesBB(vector2d<s32>(x, y));}
cursorUnderGUI doesn't seem to change to false;
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

weird, it now works again :oops: just now i tried many times but it just didn't work i do't know why. my problem has solved, how about you, instinct?

EDIT: weird, sometimes it works but sometimes not. something wrong my code?
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

bitplane wrote:Works for me in SVN. Can you show an example using minimal code?

Do you have another GUI element inside the window, and this gets the hover event instead?
I dont have acces to the SVN, since my development environment can't connect to the internet, i have to use internet on another environment... >_<

if it works in the newest SVN i guess i'll have to wait untill there is a new release, the system administrator is having holiday lol.

Here's my code snippet

Code: Select all

switch( e.EventType )
{
    case EET_GUI_EVENT:
    {
           switch( e.GUIEvent.EventType )
           {
                    case EGET_ELEMENT_HOVERED:
                    {
                             if( pCaller->getType() == EGUIET_WINDOW )
                             {
                                 core::rect<s32> WindowBox = pCaller->getAbsolutePosition();
                                core::position3d<s32> MousePos = m_pDevice->getCursorControl->getPosition();
                                if( WindowBox.isPointInside(MousePos) )
                                { 
                                      m_bHovered = true; //hover event boolean
                                }
                             }   
                    }

                    case EGET_ELEMENT_LEFT:
                    {
                           if( pCaller->getType() == EGUIET_WINDOW )
                             {
                                 core::rect<s32> WindowBox = pCaller->getAbsolutePosition();
                                core::position3d<s32> MousePos = m_pDevice->getCursorControl->getPosition();
                                if( !WindowBox.isPointInside(MousePos) )
                                { 
                                      m_bHovered = false; //hover event boolean
                                }
                             }   
                    }

           }
    }
}
EDIT: sry for the poor formatting, i had to type my code over from the dev env to the internet env :P I'm using the Irrlicht 1.5 release version
Post Reply