qhslider - horizontal slider

Name

qhslider — horizontal slider

Syntax

qhslider min max [ cmds ...]

Description

The qhslider command creates a horizontal QSlider object. This is a handle that can be dragged up or down in a stepwise manner. If a callback command is given it will be executed when the slider value changes.

The slider may have its tracking capability set to '1' or '0' using the qsettracking command. A slider that has its tracking enabled will invoke the callback command continously throughout the drag. However, when tracking is disabled, the callback command will be invoked only when the user releases the mouse button. Tracking is enabled by default.

The slider may have tickmarks in various locations (see the qsettickposition command for details).

Sliders may have their value set programmatically using qsetvalue.

Use qvslider to make a vertical slider.

Arguments

min max

The minimum and maximum value for the slider. These must be integers.

cmds

One or more callback commands. These are invoked whenever the slider handle is dragged. The new value is appended to the callback command before evaluation. It is the programmers responsibility to ensure that the resulting command is a valid Tcl command.

Examples

Ex.1: Horizontal slider

set w [qwidget ]
qsetwindowtitle QHSlider
qvboxlayout {
	# Editor to display slider values
	set t [qtextedit]

	# Slider will append values to editor when moved
	qhslider 1 10 "qappend $t"

	# Tick position can be "noticks", "above", "left", "below", "right", "bothsides"
	qsettickposition bothsides 
}
qshow $w

Example Horizontal slider creates a slider with range 1-10. When the slider is moved its value will be appended to the callback expression, which forms a statement to append the value to the previously created text editor.

The QHSlider operates with integer values.