[ Previous | Next | Contents | Glossary | Home | Search ]
Motif 2.1 Programmer's Guide



Scale

A Scale graphically displays a value between two end points. Its appearance and behavior are much like those of a ScrollBar without arrows. However, unlike a ScrollBar, a Scale can optionally display a title. In addition, a Scale can optionally display a textual version of its value to supplement the graphic display of its value.

Like a ScrollBar, a Scale has a minimum, a maximum, and a current value. The current value must be between between the minimum and maximum, inclusive.

Scales can either be editable (the default) or noneditable. The XmNeditable resource controls this attribute. Once set, a user cannot change the value in a noneditable Scale. An editable Scale, on the other hand, allows the user to supply a new value.

The increment by which the arrow keys move the slider is always 1, but the application can supply a multiple increment (XmNscaleMultiple) analogous to ScrollBar's XmNpageIncrement. Scale has two callback lists: XmNvalueChangedCallback is invoked when the user changes the value but is not in the process of dragging the slider, and XmNdragCallback is invoked when the user changes the value while dragging the slider.

Your application cannot control the size of the slider.

Scale has resources controlling whether the orientation is vertical or horizontal and which end of the Scale represents the minimum value. Other resources control aspects of the Scale's appearance, including the width and height, the title string, whether or not the Scale displays the current value next to the slider, the number of decimal places in the displayed value, and a render table for the title and value.

Drag and Drop in Scale

A Scale can be the source of a drag and drop operation, but it cannot be the destination. In other words, you can drag a value from a Scale, but you cannot drop a value into a Scale. The XmNenableUnselectableDrag resource of XmDisplay holds a Boolean value. If this value is True, then users can drag from a Scale. If this value is False, then users cannot drag from a Scale.

The only part of the Scale that a user can drag is the Scale's current value. More precisely, a user can drag a textual version of the Scale's current value, not the graphic version. The textual version can only be dragged if XmNshowValue is True.

Visuals Inside a Scale

The XmNslidingMode resource controls the anchoring of the slider. There are two possibilities. One possibility (XmSLIDER) is that the slider floats freely inside the Scale. Another possibility (XmTHERMOMETER) is that the slider appears tethered to one side of the Scale. The aptly named XmTHERMOMETER mode could allow your Scale widget to emulate an old-fashioned rising column of Mercury thermometer or barometer.

The XmNsliderMark resource controls the graphic that appears inside the slider. Figure 1 illustrates all the available slider marks.

Figure 1. Different Slider Marks Inside a Scale.

View figure.

Two convenience routines, XmScaleGetValue and XmScaleSetValue, allow the application to get and set the slider value.

Tic Marks

By default, a Scale has no labels or tic marks along the rectangle in which the slider moves. The application can add these by calling XmScaleSetTicks.


[ Previous | Next | Contents | Glossary | Home | Search ]