DwtScale(3Dwt)
Name
DwtScale, DwtScaleCreate − Creates a scale widget that allows an application to display a scale for vernier control of a parameter while displaying the current value and range.
Syntax
Widget DwtScale(parent_widget, name, x, y,
width, height, scale_width, scale_height,
title, min_value, max_value, decimal_points,
value, orientation, callback,
drag_callback, help_callback)
Widget parent_widget;
char *name;
Position x, y;
Dimension width, height;
Dimension scale_width, scale_height;
DwtCompString title;
int min_value, max_value;
int decimal_points;
int value;
unsigned char orientation;
DwtCallbackPtr callback, drag_callback, help_callback;
Widget DwtScaleCreate (parent_widget, name,
override_arglist, override_argcount)
Widget parent_widget;
char *name;
ArgList override_arglist;
int override_argcount;
Arguments
parent_widget
Specifies the parent widget ID.
nameSpecifies the name of the created widget.
xSpecifies the placement, in pixels, of the left side of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNx core widget attribute.
ySpecifies, in pixels, the placement of the upper left corner of the widget window relative to the inner upper left corner of the parent window. This argument sets the DwtNy core widget attribute.
widthSpecifies the width of the widget window. (The window width is calculated based on the scale width, the label widths, and orientation.) This argument sets the DwtNwidth core widget attribute.
heightSpecifies the height of the widget window. (The window height is calculated based on the scale height, the labels, and orientation.) This argument sets the DwtNheight core widget attribute.
scale_widthSpecifies the width of the scale, excluding the scale labels. This argument sets the DwtNscaleWidth attribute associated with DwtScaleCreate.
scale_heightSpecifies the height of the scale, excluding the scale labels. This argument sets the DwtNscaleHeight attribute associated with DwtScaleCreate.
titleSpecifies the title text string to appear in the scale window widget. This argument sets the DwtNtitle attribute associated with DwtScaleCreate.
min_valueSpecifies the value represented by the top or left end of the scale. This argument sets the DwtNminValue attribute associated with DwtScaleCreate.
max_valueSpecifies the value represented by the bottom or right end of the scale. This argument sets the DwtNmaxValue attribute associated with DwtScaleCreate.
decimal_points
Specifies the number of decimal points to shift the current slider value for display of the next slider position. This argument sets the DwtNdecimalPoints attribute associated with DwtScaleCreate.
valueSpecifies the current slider position along the scale (the value selected by the user). This argument sets the DwtNvalue attribute associated with DwtScaleCreate.
orientationSpecifies whether the scale is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrientationVertical. This argument sets the DwtNorientation attribute associated with DwtScaleCreate.
callbackSpecifies the callback function or functions called back when the value of the scale changes. This argument sets the DwtNvalueChangedCallback attribute associated with DwtScaleCreate.
drag_callbackSpecifies the callback function or functions called when the user is dragging the scale slider. For this callback, the reason is DwtCRDrag. This argument sets the DwtNdragCallback attribute associated with DwtScaleCreate.
help_callbackSpecifies the callback function or functions called when a help request is made. This argument sets the DwtNhelpCallback common widget attribute.
override_arglist
Specifies the application override argument list.
override_argcount
Specifies the number of attributes in the application override argument list (override_arglist).
Description
The DwtScale and DwtScaleCreate functions create an instance of the scale widget and return its associated widget ID. The scale widget is a primitive widget figure that allows the application to display a scale for vernier control of a specific parameter by the user. The user moves or drags a slider, which is part of the scale widget, and places the slider at a position representing the desired value. The scale may have labeled text at any number of points identifying the values corresponding to the points. The scale can be made insensitive and used as an output value indicator only (for example, a thermometer or percent completion indicator).
The application passes lower and upper values for the scale as integers and can (optionally) indicate a decimal point position. For example, a DwtNminValue of 100, a DwtNmaxValue of 10000, and a DwtNdecimalPoints of 2 would produce a scale from 1.00 to 100.00. Possible values returned from this example could be 230 or 5783.
Scale widget labels are provided by its children. The labels can be any widgets created using the scale widget as the parent.
Inherited Attributes
| Attribute Name | Data Type | Default |
| Core Attributes | ||
| DwtNx | Position | Determined by the geometry manager |
| DwtNy | Position | Determined by the geometry manager |
| DwtNwidth | Dimension | Calculated based on scale width, the label widths, and the orientation |
| DwtNheight | Dimension | Calculated based on scale height, the label widths, and the orientation |
| DwtNborderWidth | Dimension | zero pixels |
| DwtNborder | Pixel | Default foreground color |
| DwtNborderPixmap | Pixmap | NULL |
| DwtNbackground | Pixel | Default background color |
| DwtNbackgroundPixmap | Pixmap | NULL |
| DwtNcolormap | Colormap | Default color map |
| DwtNsensitive | Boolean | True |
| DwtNancestorSensitive | Boolean | The bitwise AND of the parent widget’s DwtNsensitive and DwtNancestorSensitive attributes |
| DwtNaccelerators | XtTranslations | NULL |
| DwtNdepth | int | Depth of the parent window |
| DwtNtranslations | XtTranslations | NULL |
| DwtNmappedWhenManaged | Boolean | True |
| DwtNscreen | Screen * | The parent screen |
| DwtNdestroyCallback | DwtCallbackPtr | NULL |
| Common Attributes | ||
| DwtNforeground | Pixel | Default foreground color |
| DwtNhighlight | Pixel | Default foreground color |
| DwtNhighlightPixmap | Pixmap | NULL |
| DwtNuserData | Opaque * | NULL |
| DwtNdirectionRToL | unsigned char | DwtDirectionRightDown |
| DwtNfont | DwtFontList | The default XUI Toolkit font |
| DwtNhelpCallback | DwtCallbackPtr | NULL |
Widget-Specific Attributes
| Attribute Name | Data Type | Default |
| DwtNvalue | int | zero |
| DwtNtitle | DwtCompString | Scale name |
| DwtNorientation | unsigned char | DwtOrientationHorizontal |
| DwtNscaleWidth | Dimension | 100 pixels |
| DwtNscaleHeight | Dimension | 20 pixels |
| DwtNminValue | int | Zero |
| DwtNmaxValue | int | 100 |
| DwtNdecimalPoints | short | Zero |
| DwtNshowValue | Boolean | True |
| DwtNdragCallback | DwtCallbackPtr | NULL |
| DwtNvalueChangedCallback | DwtCallbackPtr | NULL |
DwtNvalueSpecifies the current slider position along the scale (the value selected by the user).
DwtNtitleTypeSpecifies the title type. You can pass DwtCString or DwtPixmap.
DwtNtitleSpecifies the title text string to appear in the scale window widget.
DwtNorientation
Specifies whether the scale is displayed vertically or horizontally. You can pass DwtOrientationHorizontal or DwtOrientationVertical.
DwtNscaleWidthSpecifies the thickness in pixels of the scale itself, not counting the labels.
DwtNscaleHeight
Specifies the height of the scale, excluding the scale labels.
DwtNminValueSpecifies the value represented by the top or left end of the scale.
DwtNmaxValueSpecifies the value represented by the bottom or right end of the scale.
DwtNdecimalPoints
Specifies the number of decimal points to shift the current slider value for display of the next slider position.
DwtNshowValueSpecifies a boolean value that, when True, states that the current value of the slider label string will be displayed next to the slider.
DwtNdragCallback
Specifies the callback function or functions called when the user is dragging the scale slider. For this callback, the reason is DwtCRDrag.
DwtNvalueChangedCallback
Specifies the callback function or functions called when the scale value was changed. For this callback, the reason is DwtCRValueChanged.
Return Value
These functions return the ID of the created widget.
Callback Information
The following structure is returned to your callback:
typedef struct {
int reason;
XEvent *event;
int value;
} DwtScaleCallbackStruct;
The reason member is set to a constant that represents the reason why this callback was invoked. For this callback, the reason member can be set to:
| DwtCRValueChanged | The user moved the slider in the scale with drag or click. |
| DwtCRDrag | The user is dragging the slider. |
| DwtCRHelpRequested | The user selected Help. |
The event member is a pointer to the Xlib structure XEvent, which describes the event that generated this callback. This structure is a union of the individual structures declared for each event type. For information on XEvent and event processing, see the Guide to the Xlib Library: C Language Binding.
The value member is set to the current value of the scale.
See Also
DwtScaleGetSlider (3Dwt), DwtScaleSetSlider (3Dwt)
Guide to the XUI Toolkit: C Language Binding
Guide to the XUI Toolkit Intrinsics: C Language Binding