The TextLabel control is used to display all the text that composes a page in a Morfik application/website. This control can automatically, and intelligently, resize itself depending on the text it needs to display. This characteristic allows the creation of complex and sophisticated views with very little effort.


textlabel32.png Key properties: Caption, Color, Font, Data Field, Hyperlink, Visible
Key events: On Click, On Mouse Over, On Mouse Out
Server Code: TextLabel = Class(TWebControl)
Browser Code: TextLabel = Class(TWebControl)


Graphical States

States Appearance Description
Normal textlabel-normal.png The default state for the control when no other state is active.
Mouseover textlabel-normal.png This view is displayed when the user moves the cursor over the control
Disabled textlabel-disabled.png This view is displayed when the control's ability to receive input is disabled.


Learn more about Morfik Styles and Themes.

Layout

Label.jpg
'

Properties

Property Description
Alignment The Alignment property is used to align the Caption text with the left, right, or center of the Control.
Auto Size The AutoSize property indicates whether the control is automatically resized at design time to display its entire contents. This property has no effect at runtime.
Border Color The BorderColor property specifies the color that should be used for drawing a rectangular border around the Control. Note: the border will not be visible unless the BorderStyle and BorderWidth properties are also set.
Border Sides The BorderSides property specifies the parts of a control's border that are displayed.
Border Style The BorderStyle property of the control defines how and if a border will be drawn around the control.
Border width The Border Width property specifies the line width used to draw the rectangular border around the Control. Note: the border will not be visible unless the BorderColor and BorderStyle properties are also set.
Can Grow The CanGrow property determines the behavior when the Caption text is too large to fit into the Control:
  • if CanGrow=No, the Control retains its design-time height
  • if CanGrow=Scroll, the Control retains its design-time height, but allows the end user to scroll through the text
  • if CanGrow=Yes, the Control increases its height to accommodate the text
Can Shrink The CanShrink property determines the behavior when the Caption text is too small to completely fill the Control:
  • if CanShrink=False, the Control maintains its design-time height
  • if CanShrink=True, the Control decreases its height to accommodate the text Note: enabling CanShrink has no effect unless CanGrow is also enabled. Using this property only makes sense if the control will contain data bound controls. If there is only a small amount of content to be displayed within the control, its height will be reduced so that it elegantly displays the content without leaving large blank areas in the page. More information on how controls can grow and shrink at runtime is available under the topic Plastic Layout.
Caption Caption is the most frequently used property of a Text orientated control as it allows setting and reading of the content (all the text) that is displayed by the control. This property can be bound to a database table field as to automatically display its contents and allow editing of them.
Color The Color property specifies the background color of the Control.
Cursor The Cursor property, if set, causes the appearance of the mouse cursor to change as it moves over the Control.
Data Field The DataField property is used to bind the Control to a database field. Either through a table or a query which is specified through the DataSource property of the Form that contains the control.
Enabled If the Enabled property is set to false, the Control's state or value cannot be changed by the user.

Note For Timer Control: This property controls whether the Timer event will be triggered at the time interval specified in the Interval property. If the Enabled property is set to false, the Timer event will not be triggered.

Font The Font property (and its sub-properties Color and Name) is used to indicate which font should be used for drawing the text in the Control.
Format The Format property may be used to control the formatting of numeric and date/time values in databound TextLabels. Note: this property is only functional for continuous forms in the current release. The Format property specifies the style in which the DateTimeEdit displays its value. There are four choices:
  • Long (e.g. Wednesday, 29 Jul 2008)
  • Medium (e.g. 29 Jul 2008)
  • Short DDMMYYYY (e.g. 29/7/2008)
  • Short MMDDYYYY (e.g. 7/29/2008)
Height The Height property specifies the vertical extent of the Control. Note: if the CanGrow or CanShrink properties are set, the actual height of the Control at run time may be different.
Hint The Hint property, if set, specifies the text of a tooltip that is displayed when the user moves the cursor over the control.
Horizontal Placement The HorizontalPlacement property, if set, governs how the Control adjusts its size and position in response to changes in the horizontal dimensions of its parent.
Hyperlink The IsHyperlink property, when set to true, turns the Caption of the Control into a hyperlink. This is most often used when the Control is bound to a hyperlink field.
Left The Left property specifies the horizontal position of the Control in the form.
Letter Spacing The LetterSpacing property, if set, specifies a little extra whitespace to insert between each character in the Caption text.
Margins The Margins property clears an area around control (outside its border).
Name The Name property specifies the identifier used to reference the control from browser- or server-side code.
Opacity The Opacity property determines the extent to which the Control obscures any controls placed in its background. A value of 0 means that background controls are fully visible, whereas a value of 100 means that background controls are completely obscured.
Shared Style The SharedStyle property can be used to force several controls always have the same appearance.
Tab Order The TabOrder property allows the developer to specify the order in which controls should receive input focus when the user steps through them using the tab key.
Tag The Tag property is used to store user data that is associated with the control.
Top The Top property specifies the vertical position of the Control in the form.
Vertical Placement The VerticalPlacement property, if set, governs how the Rectangle adjusts its size and position in response to changes in the vertical dimensions of its parent.
Visible The visible property is used to make controls visible or invisible. Invisible controls are frequently used to allow for easy access to information from a database table field, if the control is bound to one.
Width The Width property specifies the horizontal extent of the Form/control.
Word Wrap The WordWrap property determines whether the Caption text wraps around to the following line(s), if it is too long to fit on a single line.

Events (browser-side)

Event Description
On After Grow Or Shrink This event is fired within the browser after the height of a control is adjusted in order to fit its new content.
On Before Grow Or Shrink This event is fired within the browser before the height of a control is adjusted in order to fit its new content.
On Blur Event This event is fired within the browser when a control loses focus either by the pointing device or by tabbing navigation.
On Click The most commonly used event for a TextLabel control is the OnClick event, which should be handled to execute whatever action is intended when a control is clicked.
On Double Click This event is fired when the user clicks on a control within the browser.
On Focus This event is fired within the browser when a control receives focus either by the pointing device or by tabbing navigation.
On Hyperlink Click This event is fired in the browser just after a hyperlink is clicked and before the requested navigation is carried out.
On Mouse Down This event is fired within the browser when the mouse button, or any other pointing device button, is pressed while it is over a control. On a PC-based mouse, it specifically relates to the left-hand mouse button being depressed.
On Mouse Move This event is fired within the browser when the mouse, or any other pointing device button, is moved while it is over a control.
On Mouse Out This event is fired when the mouse pointer, or any other pointing device button, is moved out of the region defined by a control.
On Mouse Over This event is fired when the mouse pointer or any other pointing device is over (within the region defined by) a control.
On Mouse Up This event is fired within the browser when the mouse button, or any other pointing device button, is released over a control. On a PC-based mouse, it specifically relates to when the left-hand mouse button is being released.
On After Pushed Or Pulled This event is fired within the browser after the position of a control has changed in response to a change in the content of a sibling control.
On Before Pushed Or Pulled This event is fired within the browser before the position of a control is changed in response to a change in the content of a sibling control.

   

Events (server-side)

Event Description
On After Print This event is fired on the server by a Control after its HTML (or in the case of Report generation, PDF) content is generated.
On Before Print This event is fired by a control on the server before control’s HTML (or in the case of Report generation, PDF) content is generated.
On Print Style This event is fired on the server to allow for CSS style changes when the HTML representation of a control is being constructed.

   

Remarks

Data Binding

Use Data Field property to bound TextLabel control to the data source allowing to display information associated with a field in the Data Source.


HTML formatting

It's possible to inject HTML formatting tags directly in the TextLabel's caption. Setting Caption property to the following text :

<b>This is example</b><i> of using HTML formatting</i>

will result in displaying it in the Browser like this:

This is example of using HTML formatting

Server-side Behaviour

Related Topics