Page 1 of 1

how to get mouse keydown and keyup event for gui element

Posted: Tue Feb 16, 2010 2:13 pm
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:

Posted: Tue Feb 16, 2010 2:27 pm
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

Posted: Tue Feb 16, 2010 2:37 pm
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?

Posted: Tue Feb 16, 2010 2:44 pm
by hybrid
No, only key events also transport the mouse state. The rest needs to be stored by you. Probably exactly as zeus suggested.

Posted: Tue Feb 16, 2010 2:50 pm
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

Posted: Tue Feb 16, 2010 3:19 pm
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?

Posted: Tue Feb 16, 2010 9:26 pm
by hybrid
How should I know? But it looks pretty ok to me.

Posted: Wed Feb 17, 2010 5:54 am
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...

Posted: Wed Feb 17, 2010 6:17 am
by Virion
code?

Posted: Wed Feb 17, 2010 9:19 am
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.

Posted: Wed Feb 17, 2010 11:54 am
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.

Posted: Wed Feb 17, 2010 12:18 pm
by hybrid
See, that's why we need more input instead of more threads. But glad to see this working.