clt@pur-phy (Carrick Talmadge) (07/19/88)
This following query probably only pertains to the Mac II at the moment -- the other Mac systems not having a fast enough redraw to really bring out this "feature". I've got a question regarding what should be the correct or appropriate program behavior during a mouse down. This question is motivated by the behavior that I experience, for example, when scrolling up or down using the scrollbar arrows (or when clicking in the page up or page down regions of the scrollbar, for that matter). What seems to frequently happen is that a single click of the mouse button gets treated as an extended mouse down event. For example, if I single-click the "page up" region of the scrollbar, I end up scrolling up multiple "pages" [e.g., in the Control Panel, you go up more than one "page" of icons with a single mouse click]. The following code segment illustrates the method that I am currently employing to suppress this behavior. In this code segment, clicking in various (pre-defined) regions of the window initiates various actions from the program (the particulars aren't important here; also this code segment is not even from any bona fide program, it's just for purposes of illustration). /* various include files here */ void doContent(pt) Point *pt; { int whichAction = getAction(pt); int first = true; /* Various initializations to make sure the clicked region */ /* implies a valid action. Also check for shift-click, etc */ do { long int t1, dt; t1 = SystemTick(); if (performAction(whichAction) == false) break; /* break on an error */ dt = SystemTick() - t1; /* get time interval */ if (first) { if (dt < KeyThresh) /* default value = 16 ticks */ Delay(KeyThresh-dt, &dt); /* can second arg be NULL? */ first = false; } else { if (dt < KeyRepThresh) /* default value = 4 ticks */ Delay(KeyRepThresh-dt, &dt); } } while (StillDown()); } Notice here that I'm using KeyThresh and KeyRepThresh for the MouseDown thresholds -- maybe there are more appropriate variables/function calls to use these days. This is my first question. My second question is, given user modifiable variables [via the Control Panel] such as above, does the above behavior seem reasonable? For some purpose I probably wouldn't include KeyRepThresh [especially for something like scrolling a bitmap up or down by a single pixel at a time]. Also when you're scrolling a bitmap a page at a time, the program probably can't redraw faster than KeyRepThresh anyway. None-the-less I do have code which is extremely annoying to use if you don't have something like the above to suppress this mistaken extended-mousedown kind of behavior. I would greatly appreciate any comments or critiques... ----------------------------------------------------------------------------- Carrick Talmadge | DISCLAIMER: These opinions are those ARPA: clt@newton.physics.purdue.edu | of the author [CT], and may not USENET: ..!pur-ee!pur-phy!clt | necessarily represent those of his BITNET: talmadge@purccvm.BITNET | employer [Purdue University].