[comp.sys.atari.st.tech] Right Mouse Button Programming

mreiss@ncrcam.Cambridge.NCR.COM (mreiss) (07/30/90)

We are currently working on a project that we need to use the right mouse
button.  (Really both buttons, but ...)  We have been able to get the left
button to work fine ... single clicks, double clicks, event time out ...
using evnt_multi.  It will not work for the right button.  The programming
is the same, but it won't work.   WHY ?

I really need some help here.  PLEASE ... don't assume someone else will
answer.  If you know what the problem is please send me email.

What?  You want to know what we are doing?  Well.... I won't tell and I won't
answer email with questions about it until its done, but can you say mg with
mouse support?  WE have the left button working, but we want the right button
to work also.  PLEASE HELP

mike
-- 
Michael A. Reiss				|
						|	mike
USENET = Mike.Reiss@Cambridge.NCR.COM		|

AAron@image.soe.clarkson.edu (AAron nAAs) (07/31/90)

From article <1961@ncrcam.Cambridge.NCR.COM>, by mreiss@ncrcam.Cambridge.NCR.COM (mreiss):
> 
> We are currently working on a project that we need to use the right mouse
> button.  (Really both buttons, but ...)  We have been able to get the left

> Michael A. Reiss				|
> 						|	mike
> USENET = Mike.Reiss@Cambridge.NCR.COM		|

We was doing a project that required the use of both buttons a few months
ago, and people suggested we stray from the easy event multi approach and
write our own mouse handlers... Didn't know much about that approach, but
once you got one working I am sure it would be much better than the double
button support of event multi.

As I recall you can have event multi report on left button, right button,
both buttons (pressed at the same time), or neither buttons.  You can't
have it respond to a left click OR a right click (Which is quite a shame).
Our solution was to set it to respond to NEITHER buttons, which after still
requesting mouse button events, made it fall out no matter what happened.
We did some experimenting and found out how to make it work.

With the event multi CONSTANTLY falling through, we could check that
the variables of the event multi that had to do with the button states.
Thus we could tell what was happening to EITHER/BOTH of the mouse buttons.
We may have used the event mouse for certain loops, but the concept is
the same.

This approach seems to actually be defeating the purpose of the event multi,
which drops out on a specified event.  In our case we ended up using it as
a mouse button status reader, and if no buttons were pressed our code, after
doing nothing, eventually looped back to the event multi to continue again.

AAron nAAs
AAron@sun.soe.clarkson.edu       Disclaimer: Don't like it? Don't do it...

saj@chinet.chi.il.us (Stephen Jacobs) (08/01/90)

There are 2 attractive ways to use both mouse buttons (that I know of).  When
Atari people have replied to such inquiries in the past, they've suggested
intercepting the mouse button interrupt vector, recording what the mouse
button state is, and passing control to the original mouse button handler.
Your program can read the recorded state at its convenience.  That method is
solid and supported, but I hate having a program in supervisor mode even a
microsecond longer than necessary.  There is a documented extended line-A
variable which tracks the state of the mouse buttons.  You can poll it
(possibly as part of the timer event handling of an evnt_multi() loop) and
act accordingly.
                                       Steve J.