The SpinBox item consists of a text field and up-down arrows. The arrows may be used to increment or decrement the numeric value in the text field.

v8spinbox.jpg

Item List Specification

The DialogItemRsc field extent specifies the location and size of the SpinBox item. The x position specifies the location of the left side of the text field, and the y position specifies either the top of the text field or, if the 'label on top' attribute is set, the top of the label. If width is 0, the width of the SpinBox is calculated using the maximum number of characters the text field can contain. Specifying an explicit width is recommended. If height is 0, the height is calculated using the current dialog font.

The type field should contain SpinBox.

The ID determines the DItem_SpinBoxRsc 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_SpinBoxRsc instance.

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

The following is an example of an item list specification for the SpinBox item:

{{X_POS, Y_POS, SPNBX_W, 0}, SpinBox, SPINBOXID_EXAMPLE, ON,
0,"",""},

Item Resource Specification

The SpinBox resource is defined in a resource file with the following structure:

typedef struct ditem_spinboxrsc
{
ULong commandNumber;
ULong commandSource;
long synonymsId;
ULong helpInfo;
ULong helpSource;
long itemHookId;
long itemHookArg;
byte maxSize; // max # of chars in field //
char formatToDisplay[16]; // format str to convert from internal //
char formatToInternal[16]; // convert to internal from display str //
double minValue; // minimum value //
double maxValue; // maximum value //
double incAmount; // UpDown increment amount //
ULong mask; // only used with integer types //
ULong attributes; // other attributes //
#if defined (resource)
char label[];
char accessStr[];
#else
long labelLength;
char label[1];
#endif
#if defined (resource)
resourceclass DItem_SpinBoxRsc RTYPE_SpinBox extendedAttributes;
#define SpinBox RTYPE_SpinBox
#endif

For consistency with MicroStation's dialog boxes, a SpinBox item's label should end with a colon.

The following fields are described in the Text Item resource specification and are functionally identical in the SpinBox: maxSize, formatToDisplay, formatToInternal, minValue, maxValue and mask.

The DItem_SpinBoxRsc structure has the following unique fields. (See "Common item resource fields" for a description of any field not in this table.)

Field Description
attributes Specifies the attributes of the SpinBox item.

Valid constants for use with the attributes field:

Constant Description
SPINATTR_LABELABOVEPlace the label above the text field.

The following is an example of a SpinBox item resource.

DItem_SpinBoxRsc SPINBOXID_Example=
{
NOCMD, LCMD, NOSYNONYM, NOHELP, MHELP, HOOKID_spinBox, NOARG,
8, "%.1lf in", "%lf", 1.0, 100.0, 0.5, NOMASK, SPINATTR_LABELABOVE,
"~Spin Box Label:", "appG.spinBoxValue"
};

Item Hook Function Messages

The following messages are sent to item hook functions that are attached to SpinBox items: DITEM_MESSAGE_CREATE, DITEM_MESSAGE_DESTROY, DITEM_MESSAGE_SYNCHRONIZE, DITEM_MESSAGE_BUTTON, DITEM_MESSAGE_KEYSTROKE, DITEM_MESSAGE_STATECHANGED, DITEM_MESSAGE_GETSTATE and DITEM_MESSAGE_SETSTATE.


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