Path: utzoo!attcan!uunet!husc6!cmcl2!nrl-cmf!ames!pasteur!cory.Berkeley.EDU!soohoo From: soohoo@cory.Berkeley.EDU (Ken Soohoo) 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: <7632@pasteur.Berkeley.EDU> Date: 21 Nov 88 15:56:31 GMT References: <1988Nov19.180454.563@gpu.utcs.toronto.edu> Sender: news@pasteur.Berkeley.EDU Reply-To: soohoo@cory.Berkeley.EDU.UUCP (Ken Soohoo) Organization: University of California, Berkeley Lines: 71 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 1) If you want to wait for a double click, the second parameter in evnt_multi() controls the # of clicks you wait for, likewise the first parameter in evnt_button(). 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). But you really want that right button click? Install your own 68000 Assembly routine as the button event handler, it's _not_ hard! The button value comes in d0, save it out to a nice place, and then change it to a left click no matter what, and install the routine using vex_butv(); vex_butv(handle, new_function, old_function); int handle; void (*new_function), (*old_function); globl _NEW_BUT,_BUT_ADDR,_BUT_STATE * The true button state is saved and the Left button * flag is passed back to the AES mouse button interrupt routine. * * in: * _BUT_ADDR contains the address of the AES interrupt routine * that deals with mouse buttons. * * out: * _BUT_STATE contains the actual mouse button state prior to testing * to be read by the calling program. _NEW_BUT: tst d0 beq place move.w d0,_BUT_STATE move.w #1,d0 ; always return left button place: move.l _BUT_ADDR,-(sp) rts ; jmp to AES subroutine _BUT_ADDR: ds.l 1 _BUT_STATE: ds.w 1 In the above case, vex_butv(handle, NEW_BUT, &BUT_ADDR); to get into the new routine, and vex_butv(handle, BUT_ADDR, &dummy); to get out. Notable useful additions: another location to sense if the button was an "up" or a "down". --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