From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
Base class for controls that represent a scroll area (scroll box). One use of a scroll box is to group multiple graphical controls (such as buttons, list boxes, edit boxes, radio buttons, and so on) under the same scrollable parent (the scroll box itself). In this way, a smaller form can contain a lot of graphical objects organized in a scrollable manner in order to occupy less space on a graphical user interface.
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
function AddNewHorzScrollBox(AComponent: TCLComponent; xName: string): TclHorzScrollBox;
</div>


AddNewHorzScrollBox(xOwner:TComponent; xName:String): TclHorzScrollBox
<span style="color:blue"><b>AComponent</b></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.<br>


<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"><b>xName</b></span> : The name of the defined horzscrollbox should be written.<br>


<span style="color:blue"> xName</span> : The name of the defined horzscrollbox should be written.
The TclHorzScrollBox class creates a horizontal scroll box. This component is used to organize the contained control elements and provide navigation between content with a horizontal scrollbar.<br>


<div class="table-responsive">
{| class="wikitable" style="border: 2px solid #c3d7e0"
{| class="wikitable" style="border: 2px solid #c3d7e0"
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition  
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition  
|-
|-
|TclHorzScrollBox || HorzScrollBox1: TclHorzScrollBox;  || A variable belonging to the TclHorzScrollBox class is created.
|TclHorzScrollBox || HorzScrollBox1: TclHorzScrollBox;  || A variable belonging to the TclHorzScrollBox class is created.
|-
|-
|AddNewHorzScrollBox || HorzScrollBox1 = MyForm.AddNewHorzScrollBox(MyForm,'testHorzScrollBox'); || A new TclHorzScrollBox is added to the form.
|AddNewHorzScrollBox || HorzScrollBox1 = Form1.AddNewHorzScrollBox(Form1,'testHorzScrollBox'); || A new TclHorzScrollBox is added to the form.
|-
|-
|Width || HorzScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox.
|Width || HorzScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox.
Line 22: Line 25:
|Margins || HorzScrollBox1.Margins.Left = 50; // Right, Top, Bottom ||With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.<br>
|Margins || HorzScrollBox1.Margins.Left = 50; // Right, Top, Bottom ||With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.<br>
|}
|}
</div>


'''Example:'''<br>
<b>Example</b><br>
<pre>
var
  MyForm:TclForm;
  testButton : TclButton;
  horzScrollBox : TClHorzScrollBox;
  lytContainer : TClLayout;
  testImg : TClProImage;
  isCreated : Boolean;
void SetupImageComponent;
var
  i : Integer;
{
  if (isCreated)  exit;
  lytContainer.Width = 0;
  for (i = 1 to 7)
  {
    testImg = MyForm.AddNewProImage(lytContainer,'testImg'+IntToStr(i));
    testImg.Align = alLeft;
    testImg.Margins.Left = 10;
    testImg.Width = 100;
    MyForm.SetImage(testImg,'https://media1.cucuvi.com/Dic19/BD220BD4-7AEA-43FA-AF97-E62D073AFD1B.jpg');
    lytContainer.Width = lytContainer.Width + testImg.Width + testImg.Margins.Left;
  }
  isCreated = True;
}
void ButtonClicked;
{
  SetupImageComponent;
}
{
  isCreated = False;
  MyForm = TclForm.Create(Self);
  testButton= MyForm.AddNewButton(MyForm,'testButton','Load Images Horizontally');
  testButton.TextSettings.Font.Size=50;
  testButton.Align = alCenter;
  testButton.Height = 50;
  testButton.Width = 200;
 
  horzScrollBox = MyForm.AddNewHorzScrollBox(MyForm,'horzScrollBox');
  horzScrollBox.Align = alTop;
  horzScrollBox.Height = 100;
  horzScrollBox.Margins.Left = 10;
  horzScrollBox.Margins.Right = 10;
  horzScrollBox.Margins.Top = 10;
  horzScrollBox.ShowScrollBars = True;
 
  lytContainer = MyForm.AddNewLayout(horzScrollBox,'lytContainer');
  lytContainer.Align = alLeft;
  lytContainer.Width = 200;
 
  MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
  MyForm.Run;
}
</pre>


:'''TRObject Syntax'''
<b>Output:</b><br>
[[File:HorzScrollBox.png|500px|frameless]]<br>


  var
<h2> See Also </h2>
    MyForm:TclForm;
* [[Components]]
    testButton : TclButton;
    horzScrollBox : TClHorzScrollBox;
    lytContainer : TClLayout;
    testImg : TClProImage;
    isCreated : Boolean;
  void SetupImageComponent;
  var
    i : Integer;
  {
    if (isCreated)  exit;
    lytContainer.Width = 0;
    for (i = 1 to 7)
    {
      testImg = MyForm.AddNewProImage(lytContainer,'testImg'+IntToStr(i));
      testImg.Align = alLeft;
      testImg.Margins.Left = 10;
      testImg.Width = 100;
      MyForm.SetImage(testImg,'https://media1.cucuvi.com/Dic19/BD220BD4-7AEA-43FA-AF97-E62D073AFD1B.jpg');
      lytContainer.Width = lytContainer.Width + testImg.Width + testImg.Margins.Left;
    }
    isCreated = True;
  }
 
  void ButtonClicked;
  {
    SetupImageComponent;
  }
 
  {
    isCreated = False;
    MyForm = TclForm.Create(Self);
    testButton= MyForm.AddNewButton(MyForm,'testButton','Load Images Horizontally');
    testButton.TextSettings.Font.Size=50;
    testButton.Align = alCenter;
    testButton.Height = 50;
    testButton.Width = 200;
   
    horzScrollBox = MyForm.AddNewHorzScrollBox(MyForm,'horzScrollBox');
    horzScrollBox.Align = alTop;
    horzScrollBox.Height = 100;
    horzScrollBox.Margins.Left = 10;
    horzScrollBox.Margins.Right = 10;
    horzScrollBox.Margins.Top = 10;
    horzScrollBox.ShowScrollBars = True;
   
    lytContainer = MyForm.AddNewLayout(horzScrollBox,'lytContainer');
    lytContainer.Align = alLeft;
    lytContainer.Width = 200;
   
    MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
    MyForm.Run;
  }
 
:'''Base Syntax'''
 
  var
    MyForm:TclForm;
    testButton : TclButton;
    horzScrollBox : TClHorzScrollBox;
    lytContainer : TClLayout;
    testImg : TClProImage;
    isCreated : Boolean;
  procedure SetupImageComponent;
  var
    i : Integer;
  begin
    if isCreated then exit;
    lytContainer.Width := 0;
    for i:= 1 to 7 do
    begin
      testImg := MyForm.AddNewProImage(lytContainer,'testImg'+IntToStr(i));
      testImg.Align := alLeft;
      testImg.Margins.Left := 10;
      testImg.Width := 100;
      MyForm.SetImage(testImg,'https://media1.cucuvi.com/Dic19/BD220BD4-7AEA-43FA-AF97-E62D073AFD1B.jpg');
      lytContainer.Width := lytContainer.Width + testImg.Width + testImg.Margins.Left;
    end;
    isCreated := True;
  end;
 
  procedure ButtonClicked;
  begin
    SetupImageComponent;
  end;
 
  begin
    isCreated := False;
    MyForm := TclForm.Create(Self);
    testButton:= MyForm.AddNewButton(MyForm,'testButton','Load Images Horizontally');
    testButton.TextSettings.Font.Size:=50;
    testButton.Align := alCenter;
    testButton.Height := 50;
    testButton.Width := 200;
   
    horzScrollBox := MyForm.AddNewHorzScrollBox(MyForm,'horzScrollBox');
    horzScrollBox.Align := alTop;
    horzScrollBox.Height := 100;
    horzScrollBox.Margins.Left := 10;
    horzScrollBox.Margins.Right := 10;
    horzScrollBox.Margins.Top := 10;
    horzScrollBox.ShowScrollBars := True;
   
    lytContainer := MyForm.AddNewLayout(horzScrollBox,'lytContainer');
    lytContainer.Align := alLeft;
    lytContainer.Width := 200;
   
    MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
    MyForm.Run;
  end;
 
'''Output:'''<br>
[[File:HorzScrollBox.png|500px|frameless]]
 
= See Also =
* [[Object Properties]]
* [[Object Properties]]
* [[AddNewEvent]]
* [[AddNewEvent]]

Revision as of 10:17, 7 November 2024

AComponent : 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 horzscrollbox should be written.

The TclHorzScrollBox class creates a horizontal scroll box. This component is used to organize the contained control elements and provide navigation between content with a horizontal scrollbar.

Feature Use of Definition
TclHorzScrollBox HorzScrollBox1: TclHorzScrollBox; A variable belonging to the TclHorzScrollBox class is created.
AddNewHorzScrollBox HorzScrollBox1 = Form1.AddNewHorzScrollBox(Form1,'testHorzScrollBox'); A new TclHorzScrollBox is added to the form.
Width HorzScrollBox1.Width = 150; Allows adjusting the width of the scrollBox.
Height HorzScrollBox1.Height = 50; Allows adjusting the height of the scrollBox.
Align HorzScrollBox1.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 HorzScrollBox1.Margins.Left = 50; // Right, Top, Bottom With the Margins parameter, you can give margins at any scale from the right, left, bottom, top.

Example

 var
   MyForm:TclForm;
   testButton : TclButton;
   horzScrollBox : TClHorzScrollBox;
   lytContainer : TClLayout;
   testImg : TClProImage;
   isCreated : Boolean;
 void SetupImageComponent;
 var
   i : Integer;
 {
   if (isCreated)  exit;
   lytContainer.Width = 0;
   for (i = 1 to 7)
   {
     testImg = MyForm.AddNewProImage(lytContainer,'testImg'+IntToStr(i));
     testImg.Align = alLeft;
     testImg.Margins.Left = 10;
     testImg.Width = 100;
     MyForm.SetImage(testImg,'https://media1.cucuvi.com/Dic19/BD220BD4-7AEA-43FA-AF97-E62D073AFD1B.jpg');
     lytContainer.Width = lytContainer.Width + testImg.Width + testImg.Margins.Left;
   }
   isCreated = True;
 }
 
 void ButtonClicked;
 {
   SetupImageComponent;
 }
 
 {
   isCreated = False;
   MyForm = TclForm.Create(Self);
   testButton= MyForm.AddNewButton(MyForm,'testButton','Load Images Horizontally');
   testButton.TextSettings.Font.Size=50;
   testButton.Align = alCenter;
   testButton.Height = 50;
   testButton.Width = 200;
   
   horzScrollBox = MyForm.AddNewHorzScrollBox(MyForm,'horzScrollBox');
   horzScrollBox.Align = alTop;
   horzScrollBox.Height = 100;
   horzScrollBox.Margins.Left = 10;
   horzScrollBox.Margins.Right = 10;
   horzScrollBox.Margins.Top = 10;
   horzScrollBox.ShowScrollBars = True;
   
   lytContainer = MyForm.AddNewLayout(horzScrollBox,'lytContainer');
   lytContainer.Align = alLeft;
   lytContainer.Width = 200;
   
   MyForm.AddNewEvent(testButton,tbeOnClick,'ButtonClicked');
   MyForm.Run;
 }

Output:
HorzScrollBox.png

See Also