[comp.sys.atari.st] evnt_button

hohr@cernvax.cern.ch (roger hoh) (02/05/91)

 Hi Atarians,

 This is a second help call. (Europe didn't reply).

 The AES evnt_button() returns me zero, and is not waiting: why??

 I'm confused with this function, especialy 'cause the different
 books I own doesn't tell the same thing about the returned value.

 I just want to wait until the RIGHT mouse button is pressed.

 Help very appreciated!
 Thanks in advance.
 Roger                  hohr@cernvax.cern.ch

csbrod@immd4.informatik.uni-erlangen.de (Claus Brod ) (02/05/91)

hohr@cernvax.cern.ch (roger hoh) writes:

> The AES evnt_button() returns me zero, and is not waiting: why??
> I just want to wait until the RIGHT mouse button is pressed.

Please show us how you called it exactly!

----------------------------------------------------------------------
Claus Brod, Am Felsenkeller 2,			Things. Take. Time.
D-8772 Marktheidenfeld, West Germany		(Piet Hein)
csbrod@medusa.informatik.uni-erlangen.de
----------------------------------------------------------------------

hohr@cernvax.cern.ch (roger hoh) (02/06/91)

Thanks for your reply Claus. Here is the code I use (well,
a part of it, 'cause it's too long to by send to the net).
The weird thing is that it works with button 1 (the left
one) but not for button 2 (the right one).
In fact, the right one seems to be the same as the joystick
'fire' button.(am I right?)
I wanna put a other switch at the joystick's place to start
a chronometer with the foot ('cause hands are occupied by
a blood analysis, but that's an other story).

Thanks in advance for your help.

Roger           hohr@cernvax.cern.ch

/********************* cut here ***********************/

/* compiled with MWC (option -VGEM) */

#include <osbind.h>
#include <xbios.h>
#include <gem_inex.h>
/* this .h file contains all the init. stuff needed by AES&VDI */

#define NBR_OF_TESTS	12

main() {
    int i, nw;
    int breturn;
    int bclicks = 2;            /* wait for n clicks */
    unsigned int bmask = 2;	/* survey button n */
/* with bmask = 1, it's OK */
    unsigned int bstate = 1;	/* button pressed (0 = no, 1 = yes) */

    gem_init ();        /* in gem_inex.h */
    for (i = 0; i < NBR_OF_TESTS; i++) {
	breturn = evnt_button (bclicks, bmask, bstate,
				&nw, &nw, &nw, &nw);
	printf ("Test Nr.%02d/%d. Return value: 0x%04x\n",
		i+1, NBR_OF_TESTS, breturn);
    }
    printf("Hit return!\n");
    getchar();
    gem_exit ();        /* in gem_inex.h */
}

wolfram@cip-s02.informatik.rwth-aachen.de (Wolfram Roesler) (02/07/91)

hohr@cernvax.cern.ch (roger hoh) writes:

> The AES evnt_button() returns me zero, and is not waiting: why??
> I just want to wait until the RIGHT mouse button is pressed.

Make sure that you use the correct parameter for evnt_button. The parameter
is a bit vector indicating for which mouse button status to wait, e.g. the
bit vector 00 waits for both buttons being up, 01 waits for the left button
being down and the right one up, 10 (=dec.2) waits for the right button being
down and the left one up, and 11 (=dec. 3) waits for both buttons being down.
I suppose this is your problem..
I had another problem about this, btw: it is not possible to wait for either
the left or the right button being down (neither with evnt_button nor with
evnt_multi). But waiting just for the right button to be pushed should be
possible.

so long

Okami san

stefan@hpbbi4.BBN.HP.COM (#Stefan Bachert) (02/11/91)

If I remember correctly offhand, bstate should be the same as
bmask for your case.
Try bstate = 2.

Hope this is the correct answer

Stefan