How to detect all Mouse Keys?

BlitzMax Forums/BlitzMax Programming/How to detect all Mouse Keys?

Tibit(Posted 2005) [#1]
I get a message saying array out of length with more than 3:

If MouseHit( 1 ) 'Left
If MouseHit( 2 ) 'Right
If MouseHit( 3 ) 'Middle
If MouseHit( 4 ) 'Error - Scroll up?
If MouseHit( 5 ) 'Error - Scroll Down?
If MouseHit( 6 ) 'Error - Forward?
If MouseHit( 7 ) 'Error - Backwards?

Or have I missed somthing?


Perturbatio(Posted 2005) [#2]
scroll is MouseY()
mouse movement is MouseX and Y


klepto2(Posted 2005) [#3]
Little Typo I think:

Scroll: MouseZ()
X and y : MouseX() and MouseY()


FlameDuck(Posted 2005) [#4]
I don't think BlitzMAX supports mice with more than 3 buttons. I don't have one tho' so I can't check, but try with the MOUSE events instead.


Perturbatio(Posted 2005) [#5]
Little Typo I think:


yeah, I typed it correctly but I went back to change it to uppercase in places and obviously mistyped then.


Tibit(Posted 2005) [#6]
Can someone post a simple example on mouse events, please.


Perturbatio(Posted 2005) [#7]
Graphics 640,480,0,0

Global m1:Int,m2:Int,m3:Int,mx:Int,my:Int,mz:Int

While Not KeyDown(KEY_ESCAPE)

	Cls
	
	m1 = MouseDown(MOUSE_LEFT)
	m2 = MouseDown(MOUSE_RIGHT)
	m3 = MouseDown(MOUSE_MIDDLE)
	
	mx = MouseX()
	my = MouseY()
	mz = MouseZ()
	
	DrawText("Left: " + m1 + " Right: " + m2 + " Middle: " + m3 + " X: " + mx + " Y: " + my + " Z: " + mz, 10, 10)
	 
	Flip

Wend
End




tonyg(Posted 2005) [#8]
Graphics 650,480,0
While Not KeyHit(key_escape)
    Cls
	WaitEvent()
	Select EventID()
		Case EVENT_KEYDOWN
			DrawText "You pressed keycode " + EventData(),0,0
		Case EVENT_MOUSEDOWN
			DrawText "Pressed mouse button "+ EventData(),0,10
	End Select
	Flip
Wend

End




Tibit(Posted 2005) [#9]
The side button of the mouse seems undetectable, and all my "F-Lock" special keys return 255.


tonyg(Posted 2005) [#10]
Polledinput.bmx created an array to hold the mousestates but with only 4 positions.
I'm guessing that's
0=Mouseup
1=LMB
2=RMB
3=MMB
Not sure whether you can get additional mousedata returned if you increase this as system.win32 only checks for left,right and middle.
I retain the right to be completely wrong.


Kanati(Posted 2005) [#11]
Anyone up for creating a hook for this? I'm too lazy to break out my win32 documentation. :)


Tibit(Posted 2005) [#12]
Is forward and backwards (tumb buttons) on a mouse only for windows?

Does a Mac-Mouse look (and feel) like a PC-mouse these days?


LarsG(Posted 2005) [#13]
Is forward and backwards (tumb buttons) on a mouse only for windows?
Dunno.. never used one.. never seen one used either.. :p
Does a Mac-Mouse look (and feel) like a PC-mouse these days?
Nope.. not the standard one..


Kanati(Posted 2005) [#14]
Does a Mac-Mouse look (and feel) like a PC-mouse these days?


I think they released an optional SUPER REVOLUTIONARY NEW WAY OF USING A MOUSE!!! It actually has two buttons now. Woooooooooo. What an amazing piece of hardware. And Steve-O Jobs has it priced like gold too I would imagine. Because it's REVOLUTIONARY!!! :)

Back to the blitzing... Creating a windows hook should do it... WH_MOUSE hook using CreateWindowsHookEx or something like that. But it would have to be made in C most likely because a hook is a callback function that windows itself calls. I don't think blitz can do callbacks (though I haven't looked to verify that).


Mark Tiffany(Posted 2005) [#15]
Is forward and backwards (tumb buttons) on a mouse only for windows?

You might be able to get keyboard events for these, I seem to recall something that looked like this in the keycodes list...