Next | Prev | Up | Top | Contents | Index

xmScale

A scale widget produces an adjustable slider for adjusting some value between a minimum and a maximum. This code creates a horizontal slider:

#! /usr/sgitcl/bin/moat 
xtAppInitialize
xmMainWindow .main managed
xmScale .main.slide managed -orientation horizontal \
    -maximum 11 -value 11 -showValue True \
    -titleString "Volume"
. realizeWidget
. mainLoop

Figure 4-6 : xmScale Horizontal Slider The xmScale widget class defines the new resources, as shown in Table 4-34.

xmScale Resources
Resource NameDefault ValueType or Legal Values
-decimalPoints0Integer
-fontListInheritedFont List
-highlightOnEnterFalseBoolean
-highlightThickness2Dimension
-maximum100Integer
-minimum0Integer
-orientationverticalhorizontal
vertical
-processingDirectioncomputedmax_on_bottom
max_on_left
max_on_right
max_on_top
-scaleHeight0Dimension
-scaleWidth0Dimension
-scaleMultiple $(max-min)/10$Integer
-showValueFalseBoolean
-titleString""String
-value0Integer

The slider may be moved between the integer -minimum and -maximum. Fractional values are obtained using the -decimalPoints resource, to display a decimal point. The slider size may be set by -scaleHeight and -scaleWidth. The resource -showValue toggles display of text showing the current value, while -scaleMultiple is used for large slider moves with a <Ctrl>-Arrow key.

Table 4-35 lists callbacks defined for the xmScale widget.

xmScale Callbacks
Method Name Why
valueChangedCallbackThe scale value had changed.
dragCallbackThe slider is being dragged.

In addition, xmScale inherits the usual helpCallback from the Primitive abstract class.

In these callbacks, %value substitution may be used to retrieve the current scale position.


Next | Prev | Up | Top | Contents | Index