From Clomosy Docs

(Created page with " AddNewProLabel(TComponent, xName, xCaption): TClProLabel You can use all of the AddNewLabel properties. Apart from that, there are special uses for ProLabel. Background Color, Text Bold, Border Color, AutoSize etc. There is a simpler way to use these parameters. This is because the json structure is available. You can use properties defined with json structure. Parameters used:<br> * caption * Width * Height * PositionX * PositionY * Align * TextColor * BackgroundColor...")
 
No edit summary
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
AddNewProLabel(TComponent, xName, xCaption): TClProLabel
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function AddNewProLabel(AComponent: TCLComponent; xName, xCaption: string): TClProLabel;
</div>


You can use all of the AddNewLabel properties. Apart from that, there are special uses for ProLabel. Background Color, Text Bold, Border Color, AutoSize etc. There is a simpler way to use these parameters. This is because the json structure is available. You can use properties defined with json structure. Parameters used:<br>
<span style="color:blue"><b>AComponent</b></span> : Specifies the parent of the object to be defined.<br>
* caption
* Width
* Height
* PositionX
* PositionY
* Align
* TextColor
* BackgroundColor
* TextSize
* TextVerticalAlign
* TextHorizontalAlign
* TextBold
* MarginTop
* MarginBottom
* MarginRight
* MarginLeft
* RoundHeight
* RoundWidth
* BorderColor
* BorderWidth
* AutoSize


Let's define a proLabel.<br>
<span style="color:blue"><b>xName</b></span> : The name of the defined label should be written.<br>
<blockquote style="background-color:#F7F5EB">
 
LblUserName : TClProLabel;
<span style="color:blue"><b>xCaption</b></span> : You can enter the label title here.<br>
</blockquote>
 
Let's add a proLabel to MyForm and create its property parameters with json structure.<br>
It creates a text label used to provide explanations or information in the user interface. TclProLabel is preferred for labeling other components on the form or providing information to the user.<br>
<blockquote style="background-color:#F7F5EB">
 
  LblUserName := MyForm.'''AddNewProLabel'''(MyForm,'LblUserName','User Name :');<br>
<div class="alert alert-info" role="alert" data-bs-theme="light">
  clComponent.SetupComponent(LblUserName,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
Refer to the [[TclLabel]] page for standard label usage.
  "TextHorizontalAlign":"left","TextBold":"yes"}');
</div>
</blockquote>
 
'''Code:'''<br>
<div class="table-responsive">
'''Var'''    
{| class="wikitable" style="border: 2px solid #c3d7e0"
MyForm:TclForm;
! style="background-color: #c3d7e0"| Feature  !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition
LblUserName: TClProLabel;<br>
|-
'''procedure''' SetUsername;
|TclProLabel || ProLabel1 : TclLabel;  || A variable belonging to the TclProLabel class is created.
'''begin'''
|-
   LblUserName := MyForm.AddNewProLabel(MyForm,'LblUserName','User Name :');
|AddNewProLabel || ProLabel1 = Form1.AddNewProLabel(Form1,'ProLabel1','Test ProLabel Caption'); || A new TclProLabel is added to the form.
   clComponent.SetupComponent(LblUserName,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
|}
   "TextHorizontalAlign":"left","TextBold":"yes"}');<br> 
</div>
'''end;'''<br>
 
'''begin'''
In addition to the features of a standard label, TclProLabel offers new and advanced features, which we will explain in detail below.<br>
  MyForm := TclForm.Create(Self);
 
  SetUsername;
<div class="row">
  MyForm.Run;
<div class="col-lg-6">
'''end;'''
<div  class="card d-flex flex-column justify-content-start gap-1 mb-3 h-100" style="padding: 3;">
<div style="font-size: 16px;font-weight: bold;text-align:left;">
  clProSettings Properties
</div>
<div style="font-size: 14px;font-weight: normal;text-align:justify; max-width: 350px;">
<li>TextSettings</li>
<li>FontColor</li>
<li>FontSize</li>
<li>FontVertAlign</li>
<li>FontHorzAlign</li>
<li>BackgroundColor</li>
<li>BorderColor</li>
<li>IsTransparent</li>
<li>IsFill</li>
<li>RoundHeight</li>
<li>RoundWidth</li>
<li>IsRound</li>
<li>BorderWidth</li>
<li>AutoSize</li>
<li>WordWrap</li>
</div>
</div>
</div>
</div>
<br>
 
<div class="alert alert-warning" role="alert" data-bs-theme="light">
To learn the purpose and usage of the <b>clProSettings</b> property, please refer to [[Pro Object Properties| the page]].
</div>
 
<b>Example</b><br>
 
<pre>
Var   
  Form1:TclForm;
  Label1: TClProLabel;
 
void setLabel;
{
   Label1 = Form1.AddNewProLabel(Form1,'Label1','Clomosy PROLABEL');
   Label1.Align = alCenter;
  Label1.Width = 150;
  Label1.Height = 30;
  Label1.clProSettings.FontColor = clAlphaColor.clHexToColor('#f5428d');
  Label1.clProSettings.FontSize = 12;
  Label1.clProSettings.FontVertAlign = palcenter;
  Label1.clProSettings.FontHorzAlign = palLeading;
  Label1.clProSettings.TextSettings.Font.Style = [fsBold];
  Label1.clProSettings.IsFill = True;
  Label1.clProSettings.IsRound = True;
   Label1.SetclProSettings(Label1.clProSettings);
}
 
{
  Form1 = TclForm.Create(Self);
  setLabel;
  Form1.Run;
}
</pre>
 
<h2> See Also </h2>
* [[Components]]
* [[Pro Object Properties]]
* [[Object Properties]]
{{#seo:|title=TclProLabel Using - Clomosy Docs}}
{{#seo:|description=Explore TclProLabel on Clomosy! Learn how to implement and customize professional labels in your applications with ease.}}

Latest revision as of 15:12, 11 April 2025

AComponent : Specifies the parent of the object to be defined.

xName : The name of the defined label should be written.

xCaption : You can enter the label title here.

It creates a text label used to provide explanations or information in the user interface. TclProLabel is preferred for labeling other components on the form or providing information to the user.

Feature Use of Definition
TclProLabel ProLabel1 : TclLabel; A variable belonging to the TclProLabel class is created.
AddNewProLabel ProLabel1 = Form1.AddNewProLabel(Form1,'ProLabel1','Test ProLabel Caption'); A new TclProLabel is added to the form.

In addition to the features of a standard label, TclProLabel offers new and advanced features, which we will explain in detail below.

clProSettings Properties

  • TextSettings
  • FontColor
  • FontSize
  • FontVertAlign
  • FontHorzAlign
  • BackgroundColor
  • BorderColor
  • IsTransparent
  • IsFill
  • RoundHeight
  • RoundWidth
  • IsRound
  • BorderWidth
  • AutoSize
  • WordWrap

  • Example

    Var   
      Form1:TclForm;
      Label1: TClProLabel;
    
    void setLabel;
    {
      Label1 = Form1.AddNewProLabel(Form1,'Label1','Clomosy PROLABEL');
      Label1.Align = alCenter;
      Label1.Width = 150;
      Label1.Height = 30;
      Label1.clProSettings.FontColor = clAlphaColor.clHexToColor('#f5428d');
      Label1.clProSettings.FontSize = 12;
      Label1.clProSettings.FontVertAlign = palcenter;
      Label1.clProSettings.FontHorzAlign = palLeading;
      Label1.clProSettings.TextSettings.Font.Style = [fsBold];
      Label1.clProSettings.IsFill = True; 
      Label1.clProSettings.IsRound = True;
      Label1.SetclProSettings(Label1.clProSettings);
    }
    
    {
      Form1 = TclForm.Create(Self);
      setLabel;
      Form1.Run;
    }
    

    See Also