🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #35199

Re: button events. Wanting to wait for either one or two clicks.

#35199
From: Edgar Roeder
Date: Wed, 23 Nov 1988 15:55
34 lines
2317 bytes
In article <7632@pasteur.Berkeley.EDU>, soohoo@cory.Berkeley.EDU (Ken Soohoo) writes:
> In article <1988Nov19.180454.563@gpu.utcs.toronto.edu> romwa@gpu.utcs.toronto.edu (Mark Dornfeld) writes:
> >
> >When using the GEM event manager, is there a way of setting up
> >an event which involves clicking one OR two buttons?  I
> >am thinking of a case like the desktop, where one can select a
> >disk by clicking once and get a directory by double-clicking.
> >
>  	
> 	The problem is that the evnt_multi() evnt_button() routines
> 	just don't return anything other than the left button being
> 	clicked (although you _can_ properly sense a right click with
> 	graf_mkstate() and vq_mouse(), and I'd use graf_mkstate() with
> 	other 'desktop' routines like evnt_ calls).
> 

I have used another aproach to get either a left or a right button event in
GEM-programs (e.g. POPLIB). I have a main loop with evnt_multi() which deals
with the other events i need (keyboard, rectangle, ...). But instead of a button
event i have installed a timer event (1/70 second). When i get a timer event,
i check the mouse buttons via vq_mouse(). When a mouse button is pressed, the
program calls an evnt_button() with the appropriate flags to recognize this as
an event.
The call returns immediately and then the program can handle the button event.
If you don't call the evnt_button() routine, you won't be able to wait for the
button released (for example to prevent the last event to be recognized twice).
The 1/70 second rate is fast enough that the user does not recognize the 
difference between this procedure and a normal button event. And beside the 
mouse check you can also do other periodically needed things here (mouse echo
like rubberbanding, ...).

hope this helps

	Edgar
Technical Details
Message-ID: <647@sbsvax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!sbsvax!roeder
References: <1988Nov19.180454.563@gpu.utcs.toronto.edu> <7632@pasteur.Berkeley.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!unido!sbsvax!roeder
From: roeder@sbsvax.UUCP (Edgar Roeder)
Newsgroups: comp.sys.atari.st
Subject: Re: button events.  Wanting to wait for either one or two clicks.
Summary: you can also use timer event & vq_mouse
Keywords: evnt_button, evnt_multi
Message-ID: <647@sbsvax.UUCP>
Date: 23 Nov 88 15:55:05 GMT
References: <1988Nov19.180454.563@gpu.utcs.toronto.edu> <7632@pasteur.Berkeley.EDU>
Organization: Universitaet des Saarlandes, Saarbruecken, West Germany
Lines: 34