how to get mouse keydown and keyup event for gui element

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

how to get mouse keydown and keyup event for gui element

Post by dehseth »

I would like to recieve event whenever uses holds down mouse button over gui element (e.g IGUIImage) and releases button.. is there a way to do it? I didn't find a related event in EGUI_EVENT_TYPE enum. :roll:
Zeus
Posts: 24
Joined: Sun Dec 13, 2009 1:03 pm
Location: Germany :P

Post by Zeus »

there is a tutorial (5. User Interface). you should read it ... i also belive that this is no "advanced" question ...

if you want to chack if a mouse button is pressed there is e.g the "EMIE_LMOUSE_PRESSED_DOWN" event ... your question about gui i dont understand ... sorry ... maybe that could help you "EGET_ELEMENT_HOVERED" ... it is used if the mouse is over a gui element ...

regards zeus
Is there any posible answer ... i'm sick of it ...

http://irrlicht.sourceforge.net/phpBB2/ ... 919#215919

thanks ...
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

zeus dude,

i want to get left mouse button down and up messages when mouse pointer is over a gui element. so I want a gui event which tells me "hey left mouse down/up"... i would like to know is this already implemented, or should I find a work around for myself, and r u guys planing to implement this?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, only key events also transport the mouse state. The rest needs to be stored by you. Probably exactly as zeus suggested.
Zeus
Posts: 24
Joined: Sun Dec 13, 2009 1:03 pm
Location: Germany :P

Post by Zeus »

@hybrid: thanks

@dehseth: öhm ... oky ... now i'm realy puzzeld ... if the mouse is over a gui element you can check it with "hover" ... if the mouse button is down you can check it with "mouse down" ... i think there is no need of "both" at the same time ... for what do you need that double check ? ...

regards
Is there any posible answer ... i'm sick of it ...

http://irrlicht.sourceforge.net/phpBB2/ ... 919#215919

thanks ...
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

ok then, seems like I need to implement it by myself...

and there is a new problem! this is what I do:
I move mouse cursor onto my image and I get these events:

EGET_ELEMENT_HOVERED
EGET_ELEMENT_LEFT :?:
EGET_ELEMENT_HOVERED :?:


there's an extra tow messages in here...
And after I click and hold left mouse button over my image I got this:

EMIE_LMOUSE_PRESSED_DOWN
EGET_ELEMENT_LEFT :?:
EGET_ELEMENT_HOVERED :?:


is this a bug hybrid?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

How should I know? But it looks pretty ok to me.
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

well it is not ok. I believe I should not get left and hover messages after holding down mouse cursor over gui element, cause I do not move cursor and it does not leave element...
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

code?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Please don't spread your questions by duplicating them into several threads. We cannot answer the same question in many places, and you won' get more answers by simply cross-posting to the bug forum. I'll move this thread to the bug forum when it's necessary.

The information, that you did not move the mouse, was simply missing before. So it looked more than correct to me. I'll have to check if it happens here as well. But Virion is right, giving a simple code sample would help. It could, e.g., depend on the type of GUI element. So it would reduce the discussions if you directly tell us what you use. And make sure you give a minimal example.
dehseth
Posts: 130
Joined: Wed Dec 09, 2009 11:05 am
Contact:

Post by dehseth »

I thought this was a bug so that's why I copied my message to Bug folder. I wasn't expecting more/quick answers for that.

I figured out what's wrong with event while I was preparing a demo for you. My mistake guys, event system works fine. :roll:

Thank you for your time.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

See, that's why we need more input instead of more threads. But glad to see this working.
Post Reply