Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!apple.com!rmh From: rmh@apple.com (Rick Holzgrafe) Newsgroups: comp.sys.mac.programmer Subject: Re: Double Click in Think C Message-ID: <12981@goofy.Apple.COM> Date: 10 Apr 91 00:18:30 GMT References: <1991Apr9.203739.29376@ux1.cso.uiuc.edu> Sender: usenet@Apple.COM Organization: Apple Computer, Inc. Lines: 45 In article <1991Apr9.203739.29376@ux1.cso.uiuc.edu> dmmg1176@uxa.cso.uiuc.edu (David M Marcovitz) writes: > I assume I can do something with TickCount and GetDblTime in my > object's DoClick method, but I would rather have a DoDoubleClick > method that gets a message when I double click (and not have the > DoClick method get a message). It's poor practice to do as you suggest. It requires your application to wait the full double-click time before deciding what to do about a mouseDown. This delay is noticable to the user and will make your app seem sluggish. Proper behavior is for the double-click action to be an action taken in addition to (rather than instead of) the single-click action. For example, in the Finder, the first click selects and highlights the icon, the second (if it occurs within GetDblTime()) opens all selected icons. This lets the Finder react instantly to the first click. There is a global variable in the Think Class Library which counts clicks. It's called "gClicks". In your DoClick method: if (gClicks < 2) { /* Do single-click action */ } else { /* Do double-click action */ } > a single click (and holding the cursor down) allows you to > drag an icon around the screen; a double click allows you to edit the > icon's name. You might put a little "stickiness" on the drag: the user must move the mouse at least two pixels before the icon begins following the mouse. That way, a slightly sloppy double-click won't jiggle the icon out of position, when all the user really wants is to edit the name. It should help preserve the illusion that click-and-drag does something completely different from double-click. Hope this helps. ========================================================================== Rick Holzgrafe | {sun,voder,nsc,mtxinu,dual}!apple!rmh Software Engineer | AppleLink HOLZGRAFE1 rmh@apple.com Apple Computer, Inc. | "All opinions expressed are mine, and do 20525 Mariani Ave. MS: 3-PK | not necessarily represent those of my Cupertino, CA 95014 | employer, Apple Computer Inc."