The label item is used to draw a text string somewhere in a dialog. The text can be forced to wrap at word breaks and can be left, right or center-justified. The text of a label can be changed with a call to mdlDialog_itemSetLabel.

MDL_Programmer's_Guide-14-17-15.jpg

The label item does not need an item resource to complete its appearance, and is completely specified by information in the item list.

Item list specification

The DialogItemRsc field extent specifies the location of the label. Most label items are only a single line high. In this case, set the height to 0. The label handler will automatically make the label height equal to the current dialog font height.

The width can also be 0. In this case, the width of the item will be the width of the original label contents. If you later set the label to a longer string, it will be truncated since it will no longer fit in the same area on the screen. If the label can be changed dynamically, a width the length of the longest anticipated string should be specified.

The type field should be Label.

The dialog box manager does not use the ID since a label item does not have an item resource. It can be used, however, to differentiate between labels when a dialog has many label items. In this case, the ID would be used with a call to mdlDialog_itemGetByTypeAndId.

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

The itemArg field specifies justification, word-wrapping, and font style. Justification options are ALIGN_LEFT, ALIGN_RIGHT and ALIGN_CENTER. If no alignment is specified, ALIGN_LEFT is assumed. To specify word wrap, use the logical OR operator to combine with LABEL_WORDWRAP. To specify the bold dialog font (instead of the default normal dialog font), use the logical OR operator to combine with LABEL_FONT_BOLD.

The label field contains the text of the label item.

The auxInfo field is not used with label items.

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

{{XC, YC, 30*XC, 0}, Label, 0, ON, ALIGN_LEFT|LABEL_FONT_BOLD,
"Hello, World", ""}

Item resource specification

A label item does not have an item resource.

Item hook function messages

Since a label item does not have an item resource, it cannot have an item hook function and will not receive item messages.

Label item functions

Function Description
mdlDialog_labelSetAttributes changes the justification and weight of the label text.

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