The scale item can be used to show the state of a variable that ranges between a set of values. These items are similar to scroll bars except that they also allow the attachment of moving labels and implement the Motiff scale item within MicroStation.


Item list specification

The DialogItemRsc field extent specifies the location of the scale. The x position specifies the left edge and the y position specifies the top edge of the scale. The orientation of the scale depends on the width and height fields. If width is 0, the scale handler will make a vertical scale. If height is 0, a horizontal scale will be created. Both the width and height cannot be 0.

The type field should be Scale.

The ID determines the DItem_ScaleRsc instance to load.

The attributes field can be ON or OFF and optionally combined with HIDDEN. It will usually be ON.

The itemArg field is unused and should usually be set to 0.

The label field can override the label contained in the DItem_ScaleRsc instance.

The auxInfo field can currently override only the access string contained in the DItem_ScaleRsc instance.

The following is an example of a scale item list specification:

0, "", ""}

Item resource specification

The scroll bar item is defined in a resource file with the following structure:

typedef struct ditem_scalersc
ULong commandNumber;
ULong commandSource;
long synonymsId;
ULong helpInfo;
ULong helpSource;
long itemHookId;
long itemHookArg;
double minValue;
double maxValue;
double incAmount;
double pageIncAmount;
long associatedTextId;
ULong attributes;
char formatToDisplay[16];
#if defined (resource)
char label[];
char accessStr[];
char minLabel[];
char maxLabel[];
long labelLength;
char label[1];
} DItem_ScaleRsc;

The DItem_ScaleRsc structure has the following unique fields. See CommonItemResourceFields for a description of any field not in this table.

Field Description
minValue Specifies the value associated with the minimum position of the scale slider.
maxValue Specifies the value associated with the maximum position of the scale slider.
incAmount Specifies the amount the current value of the scale is changed when the user clicks on the scale arrows.
pageIncAmount Specifies the amount the current value of the scale is changed when the user clicks in the page area of the scale. The page areas are the areas between the slider and the scale arrows.
associatedTextId This field specifies the resource ID of a text item that will be associated with the scale item. As the user drags the mouse on the slider, the associated text item will be dynamically set to the value of the scale based upon it's current slider position.
attributes Specifies the attributes of the scale item. It is constructed by combining the constants from the attributes table (below) with the logical OR operator.
formatToDisplay An sprintf format string to convert the value of the scale item into a display value when the SCALE_SHOWVALUE attribute is used.
minLabel A string which should be used as the label for the minimum value of the scale item.
maxLabel A string which should be used as the label for the maximum value of the scale item.

The following table lists possible values for the attributes field (described above) and the meaning of those values:

attributes Value Meaning
SCALE_HASARROWS Indicates that the scale item should be drawn with single step adjustment arrows at each end of the scale.
SCALE_SHOWVALUE Indicates that the current scale value should be displayed alongside the slider.
SCALE_LIMITSONSIDE Indicates that the range limits for the scale are to be displayed at the side of the scale item and not at the ends. By default, scale ranges are displayed at the ends of the scale item. Limits are most commonly placed on the side when the scale is vertically oriented.

The following is an example of a scale item resource. This item is used in the Color Palette dialog box, and is defined in MicroStation's resource file.

0.0, 100.0, 1.0, 5.0, TEXTID_ColorPal_AltColorSpace3,
SCALE_HASARROWS, "%.0lf", "", "", "", ""

Item hook function messages

The following messages are sent to item hook functions attached to scale items:

















The RTYPE_Scale message is used to allow the item hook function to display textual information as the current item value instead of the current scale item value. This message is only sent when the SCALE_SHOWVALUE attribute is set on the scale item. The message is sent to the hook function each time the item handler needs to display the current value of the scale item alongside the scale slider. The dimP->auxMessageType field will be set to SCALE_AUXMESSAGE_FORMATVALUE and the dimP->auxInfoP field will point to a buffer into which the hook function can place an ASCII string to be displayed as the current scale item value. The newitems MDL example application shows various usages of the scale item.

When handling the DITEM_MESSAGE_BUTTON message for a BUTTONTRANS_DOWN event, the item hook function can use a motion function (the u.button.motionfunc member) to allow the application to track cursor movement while the button is down.

Scale item functions

There are no scale item functions.

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.