C1Elastic Reference > C1Elastic Properties > TagWidth Property |
Returns or sets the width of the captions (tag labels) created from the tag property of child controls.
[form!]C1Elastic.TagWidth[ = value As Long ]
This property allows you to use the Tag property of the Elastic's children as labels, rather than using label controls. This can save valuable labels, and facilitates form design because:
· When you move the controls, the labels go with them.
· If the controls are aligned, the labels are aligned.
· If you change the Elastic's font, all labels automatically use the new font.
Tag labels can be placed on the left, right, above, or below the control being labeled, depending on the setting of the TagPosition property.
When TagPosition is set to 0 - tgLeft or 3 - tgRight, the labels have the same height as the controls being labeled. The width of the labels is determined by the TagWidth property, as explained below.
When TagPosition is set to 1 - tgAbove or 3 - tgBelow, the labels have the same width as the controls being labeled. The height of the labels is determined by the TagWidth property, as explained below.
Positive TagWidth values are interpreted as the absolute label sizes, measured in Twips.
For example, if you set the TagWidth to 1000, the tag labels will always be 1000 Twips wide (or high).
Negative TagWidth values are interpreted as percentages of the size of the control being labeled. For example, if you set TagWidth to -50, the tag labels will always be half as wide (or high) as the controls being labeled.
Here are some examples that show typical uses for this property (the code assumes an Elastic control named el):
' keep the labels always as wide as the controls:
el.TagPosition = tgLeft
el.TagWidth = -100 ' 100%
' keep the labels 1000 Twips wide:
el.TagPosition = tgLeft
el.TagWidth = 1000 ' 1000 twips
' keep the labels as tall as the controls:
el.TagPosition = tgAbove
el.TagWidth = -100 ' 100%
' keep the labels 100 Twips tall:
el.TagPosition = tgAbove
el.TagWidth = 100 ' 100 twips
Setting TagWidth to zero disables the tag labels.
Label justification is determined by the CaptionPos property. The appearance and behavior of the tag labels is also affected by the WordWrap and Font properties. The distance between the tag labels and the controls is determined by the ChildSpacing property.
If you change a control's Tag property at runtime, you must tell the Elastic to update the tag label. You can accomplish this with the Refresh method, as in the example below:
' assuming Text1 is inside el
Text1.Tag = "New Label"
el.Refresh
Long