SetTrackBarValue trackbar,value

Parameters

trackbar - trackbar gadget

value - new value; clamped into the trackbar's range

Description

Moves a trackbar's thumb to a value.

Use it to load a saved setting into the control or reset it to a default - SetTrackBarValue scaleBar,100 puts a percentage control back to normal. Values outside the range set with SetTrackBarRange are clamped.

Setting from code is silent. User changes are chattier: while the thumb is dragged the trackbar posts replaceable $401 snapshots (late ones overwrite earlier unread ones in the queue), then one final critical $401 when the drag ends, each carrying the value in EventData. Read the settled value any time with TrackBarValue.

See it working in the native input controls sample.


See also: TrackBarValue, SetTrackBarRange, SetTrackBarStep, CreateTrackBar.

Index