From Clomosy Docs
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
Tags display text. You place a label on a form when you need to define or annotate another component, such as an edit box, or when you want to add text to the form. The standard label component TclLabel is a windowless control. Tags typically display read-only static text that cannot be changed by the application user.<br> | Tags display text. You place a label on a form when you need to define or annotate another component, such as an edit box, or when you want to add text to the form. The standard label component TclLabel is a windowless control. Tags typically display read-only static text that cannot be changed by the application user.<br> | ||
AddNewLabel(TComponent | AddNewLabel(xOwner:TComponent; xName,xCaption:String): TclLabel | ||
<span style="color:blue">''TComponent''</span> : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in. | <span style="color:blue">''TComponent''</span> : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in. | ||
| Line 10: | Line 10: | ||
<span style="color:blue">''xCaption''</span> : You can enter the chart title here. | <span style="color:blue">''xCaption''</span> : You can enter the chart title here. | ||
{| class="wikitable" style="border: 2px solid #c3d7e0" | |||
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition | |||
|- | |||
|TclLabel || Label1 : TclLabel; || A variable belonging to the TclLabel class is created. | |||
|- | |||
|AddNewLabel || Label1 = MyForm.AddNewLabel(MyForm,'Label1','Test Label Caption'); || A new TclLabel is added to the form. | |||
|- | |||
|Width || Label1.Width = 150; ||Allows adjusting the width of the label. | |||
|- | |||
|Height || Label1.Height = 50; ||Allows adjusting the height of the label. | |||
|- | |||
|Align || Label1.Align = alTop; ||With the Align parameter, you can specify where you want our component to be aligned in the form. This parameter has multiple positioning properties. See the [[Object_Properties#Align | page]] to learn about these features. | |||
|- | |||
|Margins || Label1.Margins.Left = 50; // Right, Top, Bottom ||With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.<br>[[File:TclLabelMargins.png|frameless|200px]]<br><br> | |||
|- | |||
|TextSettings || Label1.StyledSettings = ssFamily;<br>Label1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c');<br>Label1.TextSettings.Font.Size = 20;<br>Label1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline] || Text formatting is performed in the component. To see the usage, see [https://www.docs.clomosy.com/index.php/Object_Properties#Text_Settings page]. | |||
|- | |||
|Text || Label1.Text = 'Label's Text'; || It represents the text within the component. The text entered by the user or set by the program is managed through this property. | |||
|- | |||
|Caption ||Label1.Caption = 'Button Caption'; || It represents the text displayed on the component. The Caption specifies the textual label that the component presents to the user. | |||
|} | |||
[[File:TclLabelMargins.png|frameless| | |||
'''Example:'''<br> | '''Example:'''<br> | ||
:'''TRObject Syntax''' | :'''TRObject Syntax''' | ||
| Line 117: | Line 56: | ||
} | } | ||
:'''Base Syntax''' | |||
'''var''' | |||
MyForm:TclForm; | |||
testLabel : TclLabel;<br> | |||
'''begin'''<br> | |||
MyForm := TclForm.Create(Self); | |||
testLabel:= MyForm.AddNewLabel(MyForm,'testLabel','Test Label Caption'); | |||
testLabel.StyledSettings := ssFamily; | |||
testLabel.TextSettings.Font.Size:=20; | |||
testLabel.Align := alCenter; | |||
testLabel.Margins.Left:= 50; | |||
testLabel.Margins.Top:= 10; | |||
testLabel.Height := 50; | |||
testLabel.Width := 150;<br> | |||
MyForm.Run;<br> | |||
'''end;''' | |||
'''Output:'''<br> | '''Output:'''<br> | ||
Revision as of 14:59, 22 August 2024
The TclLabel component is used to output a user-modifiable text (it can of course also be modified by a program).
Tags display text. You place a label on a form when you need to define or annotate another component, such as an edit box, or when you want to add text to the form. The standard label component TclLabel is a windowless control. Tags typically display read-only static text that cannot be changed by the application user.
AddNewLabel(xOwner:TComponent; xName,xCaption:String): TclLabel
TComponent : The variable name of the defined component is written. Here you should write the component variable name of whatever your component will be in.
xName : The name of the defined label should be written.
xCaption : You can enter the chart title here.
| Feature | Use of | Definition |
|---|---|---|
| TclLabel | Label1 : TclLabel; | A variable belonging to the TclLabel class is created. |
| AddNewLabel | Label1 = MyForm.AddNewLabel(MyForm,'Label1','Test Label Caption'); | A new TclLabel is added to the form. |
| Width | Label1.Width = 150; | Allows adjusting the width of the label. |
| Height | Label1.Height = 50; | Allows adjusting the height of the label. |
| Align | Label1.Align = alTop; | With the Align parameter, you can specify where you want our component to be aligned in the form. This parameter has multiple positioning properties. See the page to learn about these features. |
| Margins | Label1.Margins.Left = 50; // Right, Top, Bottom | With the Margins parameter, you can give margins at any scale from the right, left, bottom, top. |
| TextSettings | Label1.StyledSettings = ssFamily; Label1.TextSettings.FontColor = clAlphaColor.clHexToColor('#8a067c'); Label1.TextSettings.Font.Size = 20; Label1.TextSettings.Font.Style = [fsItalic]; //[fsItalic,fsUnderline] |
Text formatting is performed in the component. To see the usage, see page. |
| Text | Label1.Text = 'Label's Text'; | It represents the text within the component. The text entered by the user or set by the program is managed through this property. |
| Caption | Label1.Caption = 'Button Caption'; | It represents the text displayed on the component. The Caption specifies the textual label that the component presents to the user. |
Example:
- TRObject Syntax
var
MyForm:TclForm;
testLabel : TclLabel;
{
MyForm = TclForm.Create(Self);
testLabel= MyForm.AddNewLabel(MyForm,'testLabel','Test Label Caption');
testLabel.StyledSettings = ssFamily;
testLabel.TextSettings.Font.Size=20;
testLabel.Align = alCenter;
testLabel.Margins.Left= 50;
testLabel.Margins.Top= 10;
testLabel.Height = 50;
testLabel.Width = 150;
MyForm.Run;
}
- Base Syntax
var MyForm:TclForm; testLabel : TclLabel;
begin
MyForm := TclForm.Create(Self); testLabel:= MyForm.AddNewLabel(MyForm,'testLabel','Test Label Caption'); testLabel.StyledSettings := ssFamily; testLabel.TextSettings.Font.Size:=20; testLabel.Align := alCenter; testLabel.Margins.Left:= 50; testLabel.Margins.Top:= 10; testLabel.Height := 50; testLabel.Width := 150;
MyForm.Run;
end;
