cObject
---cWebObject
------cWebBaseUIObject
---------cWebBaseDEOServer
------------cWebBaseControl
---------------cWebLabel
Use the cWebLabel class to display a text string as a label. The text is displayed in the label position of the control's column position (piColumnIndex).
If you want to display a label next to a control (e.g. cWebForm, cWebEdit, etc.) then you would not use a cWebLabel object. Instead, use the control's built-in label support via the psLabel property.
Labels are ideal for displaying a simple read-only text string.
Object oDialog is a cWebModalDialog Set piWidth to 300 Set piColumnCount to 4 Object oDescription is a cWebLabel Set psCaption to "This is the week that was" Set piColumnIndex to 1 Set piColumnSpan to 0 End_Object End_Object
The above example displays a text string ("This is the week that was") in the 'label position' of the 2nd layout column of oDialog.
The Web Framework uniquely identifies each web object via a combination of the object hierarchy (object nesting), and object name. This means that web object names must be unique within their parent (i.e. each sibling web object must have a unique name).
Label controls must be placed within a web container (e.g. cWebPanel, cWebView or cWebModalDialog).
Label controls may not be nested inside other web controls. You may not mix web panels and web controls as sibling objects.
Web controls are positioned by HTML flow layout (left to right, top to bottom). The relative position of the control in this flow is determined by the location of the object declaration in your code.
In addition to the flow layout, each web container is divided into a fixed number of equal-width columns (piColumnCount). Child controls are aligned to these columns to determine their horizontal position and width.
Set piColumnIndex to position a label control in a particular column of the parent container.
Set piColumnSpan to determine the width of the label control i.e., the number of columns occupied by the control. The actual width is determined by the number of columns and the width of the parent container.
For more information, see Positioning and Layout of Controls.
By default a label's caption (psCaption) is vertically aligned to psLabel text of a control such as a cWebForm or cWebEdit.
If you wish to vertically align the label's caption to the control portion of a cWebForm or cWebEdit etc. then you can offset the caption by setting the label's pbShowLabel property to true. Setting pbShowLabel enables the label property's own psLabel. Normally, you would not set the psLabel property (i.e. a label for a label), but simply activating pbShowLabel will offset the vertical alignment of the label's caption to the same position occupied by a cWebForm's control which may be desirable in certain cases.
This control can be used as a valid drop target by registering it as such in a cWebDragDropHelper object.
The supported actions for this control are:
- C_WebDropOnControl
This allows the control to accept data dragged from elsewhere in the control (if configured that way) and can also be used to accept files when registered within a cWebDragDropFileHelper.
The color of a label control is determined by the web application's CSS theme (psTheme). You can define additional or replacement CSS styles in your web application's application.css file. Set psCSSClass to the CSS class name you would like to be applied to a label control.
Set psBackgroundColor and psTextColor to directly override the control's CSS themed color.