Page 1 of 1
A way to know if the mousebutton was pressed or released.
Posted: Wed May 11, 2005 1:09 am
by Joakim Christiansen
A way to know if the mousebutton was pressed or released.
I had to make my
own little procedure to do this.
The command MouseButton() only return if it's down or not.
Posted: Wed May 11, 2005 3:27 am
by dracflamloc
Also, a command like MouseButton() that works even if the mouse is NOT captured... It's very annoying to need a mouse to be captured just to tell if its been clicked.
Posted: Thu May 12, 2005 5:36 pm
by Joakim Christiansen
I also want to know it the keyborad button was pressed...
We should have a KeyboardPressed()
Posted: Thu May 12, 2005 5:51 pm
by Fred
Isn't KeyboardReleased() enough ?
Posted: Thu May 12, 2005 6:05 pm
by Joakim Christiansen
Maybe it is, sorry then...
Edit:
But it would make the command set more complete.
I think it should be something like this:
Code: Select all
Result = MouseDown(ButtonNumber)
Result = MousePressed(ButtonNumber)
Result = MouseReleased(ButtonNumber)
Result = KeyboardDown(KeyID)
Result = KeyboardPressed(KeyID)
Result = KeyboardReleased(KeyID)
Posted: Thu May 12, 2005 7:03 pm
by dracflamloc
Yes it is, however my point about mousecommands not working when the mouse is released should be considered =)
Posted: Thu Apr 06, 2006 8:42 pm
by Joakim Christiansen
Actually we should be able to know if any button is released or pressed so we don't have to create our own stupid procedures to find it out.
It would make the command set more complete and I recommend functions like this

:
Code: Select all
If KeyboardKey(#PB_Key_Left,#PB_Button_Pressed)
;do something
EndIf
If MouseButton(#PB_MouseButton_Left,#PB_Button_Released)
;do something
EndIf
Code: Select all
#PB_Button_Down
#PB_Button_Pressed
#PB_Button_Released
;or maybe shorter syntax like #Down, #Pressed, #Released... whatever
It should be optional and the default one should be #PB_Button_Down
Am I complaining now?

Posted: Fri Apr 07, 2006 8:51 am
by blueznl
first of all, some native rmb support would be nice, as well as mousewheel support!
anyway, i currently use:
Code: Select all
Procedure.l x_leftmousebutton() ; return current state of left mousebutton
;
; retval: #True - mouse button down
; #False - mouse button up
;
; note: does not use events!
;
If GetSystemMetrics_(#SM_SWAPBUTTON) = 0
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_LBUTTON))
Else
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_RBUTTON))
EndIf
EndProcedure
Procedure.l x_rightmousebutton() ; return current state of right mousebutton
;
; note: does not use events!
;
If GetSystemMetrics_(#SM_SWAPBUTTON) = 0
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_RBUTTON))
Else
ProcedureReturn x_bool(GetAsyncKeyState_(#VK_LBUTTON))
EndIf
EndProcedure
Procedure.l x_mousewheel(mode.l) ; returns number of lines up / down upon using the scrollwheel after a #WM_MOUSEWHEEL event
;
; *** returns number of lines up / down upon using the scrollwheel after a #WM_MOUSEWHEEL event
;
; in: mode.l = 0 - one line per message, return -1 for up, +1 for down
; = 1 - use windows setting for calculating number of lines, from -n to +n
; retval: <0 - up
; >0 - down
;
If mode = 0
d = x_sgn( EventwParam() >> 16 )
Else
;
; #SPI_GETWHEELSCROLLLINES = 104
;
d = 0
SystemParametersInfo_(104,0,@d,0)
d = (EventwParam() >> 16)*d/120
;
EndIf
ProcedureReturn d
EndProcedure