dwl10@uts.amdahl.com (Dave Lowrey) (03/08/90)
I can find no "standard" coding technique to handle "double clicking" of a gadget. My guess would be: o When a gadget is selected, start a timer o If the next "select" msg isn't the same gadget, then cancel the timer, and (perhaps) de-select the original gadget. o If the timer elapses, then we won't have a double click. o If the user selects our gadget before the timer runs out, then consider that a double click. Is there any sample code, on a fish disk, that uses "double clicking"? What is the "best" value to use when timing a double click? -- "This ain't Rock 'N Roll, | These be my words, not my employer's! this is Genocide!" |Dave Lowrey - Amdahl Corp. - Houston, TX David Bowie - |In Texas: {moray,uhnix1}!starsoft!david "Daimond Dogs" |The World: dwl10@uts.amdahl.com (amdahl!dwl10)
dylan@cs.washington.edu (Dylan McNamee) (03/08/90)
In article <79yO02zd8fMp01@amdahl.uts.amdahl.com> dwl10@uts.amdahl.com (Dave Lowrey) writes: >I can find no "standard" coding technique to handle "double clicking" >of a gadget. > >My guess would be: > o When a gadget is selected, start a timer > o If the timer elapses, then we won't have a double click. > o If the user selects our gadget before the timer runs out, then > consider that a double click. > >What is the "best" value to use when timing a double click? ^ NO Question Here! Use the preferences value...I think you get it through some twisted set of getPrefsMumble calls. Once the prefs double click interval is read, your description _is_ practically an example of doing double-clicks. It's really important to respect preferences settings. New users usually like the double-click time to be fairly large, and it tends to shrink with mouse-experience... > > this is Genocide!" |Dave Lowrey - Amdahl Corp. - Houston, TX dylan mcnamee dylan@cs.washington.edu
navas@cory.Berkeley.EDU (David C. Navas) (03/08/90)
In article <79yO02zd8fMp01@amdahl.uts.amdahl.com> dwl10@uts.amdahl.com (Dave Lowrey) writes: >I can find no "standard" coding technique to handle "double clicking" >of a gadget. Funny, I always used DoubleClick()... IsDouble = DoubleClick(StartSecs, StartMicros, CurrentSecs, CurrentMicros) A0 D0 D1 D2 D3 When you get your first gadget click, save the secs and micros portion of the intuition message, and then when you get your second click, call this function appropriately... Hope this helps. David Navas navas@cory.berkeley.edu "Think you can, think you can't -- either way it's true." Henry Ford
phi@goanna.oz.au (Philip Hingston) (03/08/90)
In article <79yO02zd8fMp01@amdahl.uts.amdahl.com>, dwl10@uts.amdahl.com (Dave Lowrey) writes: > I can find no "standard" coding technique to handle "double clicking" > of a gadget. > > [stuff deleted] > The IntuiMessage contains two fields, Seconds and Micros. Save these on the first click. The Intuition function DoubleClick(s1, m1, s2, m2) returns whether two such times are close enough to be a double-click. This uses the current double-click time --- the one that can be altered through preferences. phi -- Philip Hingston, Computer Science,ACSnet: phi@goanna.cs.rmit.oz R.M.I.T. ARPA: phi%goanna.cs.rmit.oz.au@uunet.uu.net GPO BOX 2476 V, CSNET: phi%goanna.cs.rmit.oz.au@australia Melbourne, 3001, AUSTRALIA UUCP: ...!uunet!goanna.cs.rmit.oz.au!phi
ckp@grebyn.com (Checkpoint Technologies) (03/08/90)
In article <11002@june.cs.washington.edu> dylan@june.cs.washington.edu (Dylan McNamee) writes: >In article <79yO02zd8fMp01@amdahl.uts.amdahl.com> dwl10@uts.amdahl.com (Dave Lowrey) writes: >>I can find no "standard" coding technique to handle "double clicking" >>of a gadget. >> >>My guess would be: >> o When a gadget is selected, start a timer >> o If the timer elapses, then we won't have a double click. >> o If the user selects our gadget before the timer runs out, then >> consider that a double click. >> >>What is the "best" value to use when timing a double click? > ^ >NO Question Here! Use the preferences value...I think you get >it through some twisted set of getPrefsMumble calls. > >Once the prefs double click interval is read, your description >_is_ practically an example of doing double-clicks. Oh, close, but not quite. There's an intuition.lirary call, DoubleClick(). You use it thus: o You get a SELECTDOWN, the first click. Pull the time out of the IntuiMessage. o You get another SELECTDOWN, and decide it's the same gadget. o Pass both the first time value (the one you saved) and the second to DoubleClick() and it will return TRUE if the two are closely enough spaced to be considered a double-click. Please, don't do it the way GEM does it. GEM must wait the double-click interval before acting upon the first click, to be sure it's not a double click. In the Amiga, the first click is a selection, the second is launch. Act upon both.
mwm@raven.pa.dec.com (Mike (Real Amiga have keyboard garages) Meyer) (03/08/90)
>> I can find no "standard" coding technique to handle "double clicking" >> of a gadget. >> >> My guess would be: >> o When a gadget is selected, start a timer >> o If the next "select" msg isn't the same gadget, then cancel the >> timer, and (perhaps) de-select the original gadget. >> o If the timer elapses, then we won't have a double click. >> o If the user selects our gadget before the timer runs out, then >> consider that a double click. Double-clicking support is built on the assumption that the second click is in some manner an extension of the first click. The canonical way is: init: set micros & seconds to "impossible" values (-1?). On reciept of message indicating a click: if this was the double-click device if DoubleClick on saved micros & seconds & values from the message do double-click action reset micros & seconds to impossible # paranoia otherwise do single-click action set micros & seconds to values from the message Note that if you _really_ don't want to do the single click action if there's a double click, this won't work. I don't know of any way to deal with it, except as you described. But in that case, you wind up delaying the single-click action until the timer goes off, which produces a painful delay in activity after a click. <mike -- Cats will be cats and cats will be cool Mike Meyer Cats can be callous and cats can be cruel mwm@relay.pa.dec.com Cats will be cats, remember this words! decwrl!mwm Cats will be cats and cats eat birds.
usenet@cps3xx.UUCP (Usenet file owner) (03/08/90)
In article <79yO02zd8fMp01@amdahl.uts.amdahl.com> dwl10@uts.amdahl.com (Dave Lowrey) writes: >I can find no "standard" coding technique to handle "double clicking" >of a gadget. > Yup there is. If you take a look a IDCMP messages they include a time stamp. Save the timestamp when you get a click, then compare it to the timestamp in the second click with the DoubleClick intuition.library function. Simple enuff? Joe Porkka porkka@frith.egr.msu.edu
peter@sugar.hackercorp.com (Peter da Silva) (03/08/90)
In article <79yO02zd8fMp01@amdahl.uts.amdahl.com> dwl10@uts.amdahl.com (Dave Lowrey) writes: > What is the "best" value to use when timing a double click? There is a routine you can use, "DoubleClick", to determine if a double-click time has elapsed. Or you can look it up in the preferences structure. You should not attempt to roll your own. -- _--_|\ Peter da Silva <peter@sugar.hackercorp.com>. / \ \_.--._/ I haven't lost my mind, it's backed up on tape somewhere! v "Have you hugged your wolf today?" `-_-'
tell@oscar.cs.unc.edu (Stephen Tell) (03/09/90)
Re: how to tell if two mouse events constitute one double click or two single clicks? There is a function in one of the libraries to to this. I think it is called DoubleClick(), but I'm not sure. It was in the 1.1 (Addison Wesley) RKMs. The arguments are DoubleClick(s1, m1, s2, m2) where s1 and m1 are seconds and milliseconds (microseconds?) of the first click and s2 and m2 are the second click. I may have seconds and fractions of a second reversed. I think all 4 args are longs. It returns true (nonzero) if the two clicks are a double-click, and otherwise returns false (zero). The routine apparently subtracts the time and compares it with that set by the user in Preferences. The time values come from the Intuition message itself, thats why they all have a timestamp (well, one reason anyway.) Its been a long time since I wrote user-interface code in C, but I'm pretty sure the essentials are right. The big win to using the DoubleClick routine is that the user's preference of double-click duration is automaticly used. Thats why we have Preferences in the first place - no "best typical values" allowed; let the user decide. -------------------------------------------------------------------- Steve Tell tell@wsmail.cs.unc.edu CS Grad Student, UNC Chapel Hill. Former chief engineer, Duke Union Community Television, Durham, NC.