Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Rui 'Trovatore' Pires on Tue 13/04/2004 19:05:19

Title: Regarding the middle button
Post by: Rui 'Trovatore' Pires on Tue 13/04/2004 19:05:19
<here follows a probably lame question that will probably be replied by one single person and after which the thread will go down into oblivion because, well, it's a lame question, but one which has been bothering me...>

I just bought a new mouse, with a scroll button. Does it count as a middle button when I press it? Because when I press it, AGS counts it as right-clicking. I don't know whether it IS a middle button, but I DO know that pressing it out of AGS does NOT process it as right click... (actually it does not seem to process at all, but since I doubt that Windows has much use for that button, I guess nothing's configured to happen). Even when I add a line like "else if (button==MIDDLE) {", it STILL processes it as right click...
Title: Re:Regarding the middle button
Post by: Pumaman on Tue 13/04/2004 19:33:49
The middle button rarely works as such - AGS simply uses DirectX to get mouse clicks, but generally the mouse wheel will register as either the left or right button rather than the middle. Not much I can do, I'm afraid.

You can however use the WHEELNORTH and WHEELSOUTH events to handle actually scrolling the mouse wheel, if you like ;)
Title: Re:Regarding the middle button
Post by: Gilbert on Wed 14/04/2004 02:59:41
And always remember, even if you utilize the middle button/wheel functions, make the game playable without them, as some people (like me) don't have a 3-button/wheel mouse.
Title: Re:Regarding the middle button
Post by: Radiant on Wed 14/04/2004 15:47:37
A workaround that tends to solve this problem is the following.
In most windows versions, you can set the middle mouse button to 'do something' such as a context menu or location help. This is done in the system config panel. Set it to 'left double click'.
Then in AGS (or whatever else you're using) detect double clicks and handle them differently.
For reasons unknown to me it is inherent in windows that applications tend not to be sent the WM_MIDDLEBUTTONDOWN and _UP messages. So blame Bill.
Title: Re:Regarding the middle button
Post by: Kweepa on Wed 14/04/2004 16:51:28
Quote from: Radiant on Wed 14/04/2004 15:47:37
A workaround that tends to solve this problem is the following.
In most windows versions, you can set the middle mouse button to 'do something' such as a context menu or location help. This is done in the system config panel. Set it to 'left double click'.
Then in AGS (or whatever else you're using) detect double clicks and handle them differently.

You can't expect users to change their settings though...

Quote
For reasons unknown to me it is inherent in windows that applications tend not to be sent the WM_MIDDLEBUTTONDOWN and _UP messages. So blame Bill.

I never noticed that. WM_MBUTTONDOWN, WM_MBUTTONUP are usually sent fine, and have been since Win 95. I don't recall writing any DirectX stuff with mouse buttons but doesn't it just translate to an event with a Windows message (ie a WM_*)?

I can understand if Allegro is changing them, but that should be fixable.
Title: Re:Regarding the middle button
Post by: Pumaman on Wed 14/04/2004 21:14:53
I'm not sure where exactly the problem is - as you say, it could be Allegro, DirectX or just Windows sending the wrong message. Either way, it's not something I've really got the time to investigate.
Title: Re:Regarding the middle button
Post by: Kweepa on Thu 15/04/2004 12:02:46
That's cool. I don't care about the middle mouse button.
I was just defending my buddy Bill :)