Path: utzoo!attcan!uunet!husc6!rutgers!bellcore!texbell!uhnix1!uhnix2!uace0 From: uace0@uhnix2.uh.edu (Michael B. Vederman) Newsgroups: comp.sys.atari.st Subject: Re: button events. Wanting to wait for either one or two clicks. Keywords: evnt_button, evnt_multi, Laser C Message-ID: <703@uhnix2.uh.edu> Date: 22 Nov 88 01:09:34 GMT References: <1988Nov19.180454.563@gpu.utcs.toronto.edu> <7632@pasteur.Berkeley.EDU> Reply-To: uace0@uhnix2.UUCP Organization: University of Houston Lines: 70 In article <7632@pasteur.Berkeley.EDU> soohoo@cory.Berkeley.EDU.UUCP (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. >> >> >>Pavneet Arora >>...!utgpu!rom!pavneet > >2) If you want to sense two click on _different_ buttons, you're going >to have to go to a little work: > > 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). > >--Kenneth Soohoo (soohoo@cory.Berkeley.Edu) > Atari 400/800/600xl/800xl/1200/130xe/65xe, 1040ST hacker > Sometime Berkeley Student, othertimes... > My opinions are my OWN, not necessarily Atari's Dear Kenneth, That is not entirely true: evnt_multi and evnt_button can be used to properly detect a right button event, you cannot however wait for both a right and a left button event at the same time (seems silly but thats the way it works). If you use graf_mkstate, you will observe two things: 1) It is SLOOOOWW in returning the mouse state, and 2) It will buffer up waiting for a key event, in other words, if you call graf_mkstate 3 times, you will lose the next three key strokes! We use a modified handler for using the right and left mouse button interaction by using vq_mouse, but this too has its problems. We will shortly change all vq_mouse calls to direct memory peeks using line-a offsets. But using the vq_mouse call wouldcause the problem of the button click being cached and the next time an evnt_multi (MU_BUTTON) or evnt_button is called, that button click will be captured. In other words, sampling the mouse state using vq_mouse (and getting bstate == 1) will cause a left button event to occur for the next evnt_button call! To get around this awkwardness, do something like: do { vq_mouse(handle, &bstate, &x, &y); if (bstate & 1) evnt_button(left mouse stuff); if (bstate & 2) evnt_button(right mouse stuff); } while (bstate != your exit condition); This, however, only tests for single button clicks. Double button clicks is much more extensive if it is for both buttons to be sampled. - mike -- for (;;) : Use ATARINET, send an interactive do_it(c_programmers); : message such as: : Tell UH-INFO at UHUPVM1 ATARINET HELP University Atari Computer Enthusiasts : University of Houston UACE