Mouse event and key event together ? Topic is solved
-
- Experienced Solver
- Posts: 77
- Joined: Tue Oct 21, 2008 6:07 pm
Mouse event and key event together ?
Is there a way i can see if a key has been pressed and then set a flag using which the mouse event is called ? I would need to see if spacebar is pressed and if yes, i would need to change the cursor and call a panning function
-
- Super wx Problem Solver
- Posts: 264
- Joined: Mon Aug 07, 2006 3:25 pm
- Location: Baia Mare, Romania
- Contact:
Hi.
You can use EVT_KEY_DOWN and EVT_KEY_UP.
In the key down event set a boolean value to true if the key is SPACE. In the key up event unset the boolean value if the key is SPACE.
In the mouse event just check for this boolean value. Of course, the devs could add an array which could hold the keys currently pressed
Also, since the events are called in order, if you hold down space and click, you will be able to determine it exactly.
Regards
You can use EVT_KEY_DOWN and EVT_KEY_UP.
In the key down event set a boolean value to true if the key is SPACE. In the key up event unset the boolean value if the key is SPACE.
In the mouse event just check for this boolean value. Of course, the devs could add an array which could hold the keys currently pressed
Also, since the events are called in order, if you hold down space and click, you will be able to determine it exactly.
Regards
Software is like sex,
It's better when it's free.
~Linus Torvalds
It's better when it's free.
~Linus Torvalds
Hi,
I'm not sure whether you want to check the mouse state in a key-event, or vice versa. But you can use one of http://docs.wxwidgets.org/stable/wx_mis ... mousestate and http://docs.wxwidgets.org/stable/wx_mis ... etkeystate
Regards,
David
I'm not sure whether you want to check the mouse state in a key-event, or vice versa. But you can use one of http://docs.wxwidgets.org/stable/wx_mis ... mousestate and http://docs.wxwidgets.org/stable/wx_mis ... etkeystate
Regards,
David