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
Line 34: Line 34:
   "TextHorizontalAlign":"left","TextBold":"yes"}');
   "TextHorizontalAlign":"left","TextBold":"yes"}');
</blockquote>
</blockquote>
'''Code:'''<br>
'''Example:'''<br>
'''Var'''   
:'''Base Syntax'''
MyForm:TclForm;
 
LblUserName: TClProLabel;<br>
  Var    
'''procedure''' SetUsername;
    MyForm:TclForm;
'''begin'''
    Label1: TClProLabel;
  LblUserName := MyForm.AddNewProLabel(MyForm,'LblUserName','User Name :');
 
  clComponent.SetupComponent(LblUserName,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
  procedure setLabel;
  "TextHorizontalAlign":"left","TextBold":"yes"}');<br> 
  begin
'''end;'''<br>
    Label1 := MyForm.AddNewProLabel(MyForm,'Label1','Clomosy LABEL');
'''begin'''
    clComponent.SetupComponent(Label1,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
  MyForm := TclForm.Create(Self);
    "TextHorizontalAlign":"left","TextBold":"yes"}');
  SetUsername;
  end;
  MyForm.Run;
 
'''end;'''
  begin
    MyForm := TclForm.Create(Self);
    setLabel;
    MyForm.Run;
  end;
 
:'''TRObject Syntax'''
 
  Var 
    MyForm:TclForm;
    Label1: TClProLabel;
 
  void setLabel;
  {
    Label1 = MyForm.AddNewProLabel(MyForm,'Label1','Clomosy LABEL');
    clComponent.SetupComponent(Label1,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
    "TextHorizontalAlign":"left","TextBold":"yes"}');
  }
 
  {
    MyForm = TclForm.Create(Self);
    setLabel;
    MyForm.Run;
  }

Revision as of 11:45, 12 February 2024

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:

  • 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.

LblUserName : TClProLabel;

Let's add a proLabel to MyForm and create its property parameters with json structure.

LblUserName := MyForm.AddNewProLabel(MyForm,'LblUserName','User Name :');
clComponent.SetupComponent(LblUserName,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center", "TextHorizontalAlign":"left","TextBold":"yes"}');

Example:

Base Syntax
 Var   
   MyForm:TclForm;
   Label1: TClProLabel;
 
 procedure setLabel;
 begin
   Label1 := MyForm.AddNewProLabel(MyForm,'Label1','Clomosy LABEL');
   clComponent.SetupComponent(Label1,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
   "TextHorizontalAlign":"left","TextBold":"yes"}');
 end;
 
 begin
   MyForm := TclForm.Create(Self);
   setLabel;
   MyForm.Run;
 end;
TRObject Syntax
 Var   
   MyForm:TclForm;
   Label1: TClProLabel;
 
 void setLabel;
 {
   Label1 = MyForm.AddNewProLabel(MyForm,'Label1','Clomosy LABEL');
   clComponent.SetupComponent(Label1,'{"Align" : "Center","MarginBottom":115,"Width" :150, "Height":30,"TextColor":"#f5428d","TextSize":12,"TextVerticalAlign":"center",
   "TextHorizontalAlign":"left","TextBold":"yes"}');
 }
 
 {
   MyForm = TclForm.Create(Self);
   setLabel;
   MyForm.Run;
 }