[comp.sys.mac.programmer] TrackControl Action Procs: Control Value Unavailable?

mitch@alpha.ces.cwru.edu (Mitchell N. Perilstein) (08/02/89)

Does anyone know how to get the value of a standard scrollbar from
within a TrackControl() callback procedure? 

If one either uses GetCtlValue(), or one looks at the contrlValue field
of the control record, it appears that the control value doesn't change
until TrackControl() is about to return (at mouse up).  If the value
of the control is needed at all times, including the time during which
it's being tracked, you're going to have a hard time.

Shouldn't TrackControl() continuously update this field as the indicator
is being dragged, to provide the most flexible programming interface? 

Or is what we see here the Standard User Interface telling us that
control changes should not be effected until the mouse button is released?


Mitchell N. Perilstein
 arpa:   mitch@alpha.ces.CWRU.edu
 usenet: {decvax,sun}!cwjcc!alpha!mitch 

earleh@eleazar.dartmouth.edu (Earle R. Horton) (08/03/89)

In article <447@cwjcc.CWRU.Edu> mitch@alpha.ces.cwru.edu (Mitchell N. Perilstein) writes:
>Does anyone know how to get the value of a standard scrollbar from
>within a TrackControl() callback procedure? 
...
>Shouldn't TrackControl() continuously update this field as the indicator
>is being dragged, to provide the most flexible programming interface? 

     You mean the TrackControl() thumb action proc.  No, there is no
way to get an updated value here, because TrackControl does not change
the control value.  You can use GetMouse() to find out where the mouse
is.  Presumably, you then use some algorithm, similar to what
TrackControl() uses to determine where to put the gray outline, to
convert from mouse position to what the new control value would be.

>Or is what we see here the Standard User Interface telling us that
>control changes should not be effected until the mouse button is released?

     I think the reason most applications do not appear to use the
thumb action proc to update changes to controls is that many times,
the standard scroll bar is used to scroll the contents of a window.
Dragging the whole window contents around while the user is trying to
position the scroll bar might present performance problems.  This
depends, of course, on the nature of the mechanism for drawing the
window contents.  If you can make your scroll bars do this, and
maintain a reasonably quick response time, then I don't see anything
in the 50,000 Commandments that forbids it.

Earle R. Horton