This object will allow you to put a fixed string on the form. It is the simplest of all objects that you will use and, along with TTASEnter, probably one of the most used. The icon for this object is on the Standard page.
PALETTE ICON & EXAMPLE
PROPERTIES
The following are the properties that apply to this object. Some are defined in Common Properties and are linked to their appropriate page.
Appearance
Caption | This is the text that will appear on the form. It is any standard string and can be modified at runtime. |
Transparent | If you want to put a label on a TImage you can check this option (set to .True.) and only the text will appear instead of both the text and the background color. |
NOTE: To get a TLabel object to appear on top of an image you must right click on the label and then choose the Bring To Front option before you move the label to the image, or, it will go behind the image.
WordWrap | If the Caption is too long to fit within a single line you can stretch the label box and check this option (set to .True.). The label will then be treated like a minor memo and the Caption will word wrap within the box provided. You can adjust the box and the Caption will wrap to fit. |
Behavior
Font
Hint
Misc
FocusControl | Even though this object has no events attached to it, you can specify which object will get focus (become active) if the user should click on the label instead of the object you expected. This can happen when the label defines what the object is. The user may not know where to click (especially if they are new to GUI programs) and, by setting this option, you give them an extra choice. The object property is a standard drop box and, if you click on the down arrow, a list of objects on your form that can receive focus (can be made active) will be displayed. |
Other
Layout | You can set where the caption will be displayed within the label box. The options are: tlTop (display at the top of the box), tlBottom (display at the bottom of the box) and tlCenter (display at the center of the box). The default value is tlTop, however, when you first create a TLabel object the box will be created the size of the caption. So, this option has little effect unless you change the size of the label box on the form. |
ShowAccelChar | If you use an ampersand (&) in the caption it will be treated the same way as if you were creating the caption for a button (see General Info for more on ALT+ keys). If this option is checked (set to .True.), the default value, the underscore will be displayed for the user. |
Position
EVENTS
This object has a single event that is called if your user clicks on the object. This event looks to your program for a special label. It is made up of the object Name, a period (.) and the Event name (Click). The full event name would be ObjectName.Click:. You would not return a value from the program, just a simple RET is all that is required. So, the user clicks on the object, if the event label exists the routine is called, you return from the routine, and the user has control again.
NOTE: You can have multiple objects call the same routine by 'stacking' the event labels on top of each other. For example, if you had two buttons you wanted to call the same event, you could do the following:
btnFirstButton.click:
btnSecondButton.click:
//event routine code would go here.
ret
The labels are not part of the code executed. They are just place keepers and tell the program where to go.
See Also : TAngleLabel TRunningText TrxLabel