From Clomosy Docs

No edit summary
No edit summary
Line 1: Line 1:
AddNewVertScrollBox (TClVertScrollBox) create scrolling areas within a form. Applications often need to display more information than will fit in a particular area. Some controls, such as list boxes, notes, and forms, can automatically scroll down their content.
<div class="alert alert-ligth border border-3 border-primary-subtle rounded-5 p-4 shadow-sm" role="alert">
AddNewVertScrollBox (xOwner:TComponent; xName:String): TClVertScrollBox
function AddNewVertScrollBox(AComponent: TCLComponent; xName: string): TclVertScrollBox;
</div>


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


AddNewVertScrollBox (TClVertScrollBox) create scrolling areas within a form. Applications often need to display more information than will fit in a particular area. Some controls, such as list boxes, notes, and forms, can automatically scroll down their content.<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  
|-
|-
|TclVertScrollBox || VertScrollBox1: TclVertScrollBox;  || A variable belonging to the TclVertScrollBox class is created.
|TclVertScrollBox || VertScrollBox1: TclVertScrollBox;  || A variable belonging to the TclVertScrollBox class is created.
|-
|-
|AddNewVertScrollBox || VertScrollBox1 = MyForm.AddNewVertScrollBox(MyForm,'VertScrollBox1'); || A new TclVertScrollBox is added to the form.
|AddNewVertScrollBox || VertScrollBox1 = Form1.AddNewVertScrollBox(Form1,'VertScrollBox1'); || A new TclVertScrollBox is added to the form.
|-
|-
|Width || VertScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox.
|Width || VertScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox.
Line 21: Line 25:
|Margins || VertScrollBox1.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 || VertScrollBox1.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>
<b>Example</b><br>


'''Example:'''<br>
In the example, a menu list has been created. The menu list includes headings such as vegetables, fruits, beverages, and types of meat. To enable a scrollable structure, a TCLVertScrollBox was created, containing buttons. When clicked, the specific button that was clicked is identified.
In the example, a menu list has been created. The menu list includes headings such as vegetables, fruits, beverages, and types of meat. To enable a scrollable structure, a TCLVertScrollBox was created, containing buttons. When clicked, the specific button that was clicked is identified.


:'''TRObject Syntax'''
<pre>
 
var
  var
  Form1: TclStyleForm;
    Form1: TclStyleForm;
  btnS : TclProButton;
    btnS : TclProButton;
  vScroll:TCLVertScrollBox;
    vScroll:TCLVertScrollBox;
  BtnCaptionArr,BtnNameArr,btnImgArr  : array of String;
    BtnCaptionArr,BtnNameArr,btnImgArr  : array of String;
  i : Integer;
    i : Integer;
 
void BtnOnClick;  
  void BtnOnClick;  
var
  var
  clickedBtn:TClProButton;
    clickedBtn:TClProButton;
{
  {
  clickedBtn = TClProButton(Form1.Clsender);
    clickedBtn = TClProButton(Form1.Clsender);
  ShowMessage(clickedBtn.Caption);
    ShowMessage(clickedBtn.Caption);
  ShowMessage(clickedBtn.Hint);
    ShowMessage(clickedBtn.Hint);
 
}
  }
 
{
  {
  BtnNameArr = ['btnVegetables','btnFruits','btnBeverages','btnMeatTypes','btnCakes'];
    BtnNameArr = ['btnVegetables','btnFruits','btnBeverages','btnMeatTypes','btnCakes'];
  BtnCaptionArr = ['Vegetables','Fruits','Beverages','Meat Types','Cakes'];
    BtnCaptionArr = ['Vegetables','Fruits','Beverages','Meat Types','Cakes'];
  btnImgArr = ['https://clomosy.com/demos/aubergine.png',
    btnImgArr = ['https://clomosy.com/demos/aubergine.png',
  'https://clomosy.com/demos/watermelon.png',
    'https://clomosy.com/demos/watermelon.png',
  'https://clomosy.com/demos/fruitJuice.png',
    'https://clomosy.com/demos/fruitJuice.png',
  'https://clomosy.com/demos/meat.png',
    'https://clomosy.com/demos/meat.png',
  'https://clomosy.com/demos/cake.png'];
    'https://clomosy.com/demos/cake.png'];
  Form1 = TclStyleForm.Create(Self);
    Form1 = TclStyleForm.Create(Self);
  Form1.SetFormColor('#ffffff','', clGNone);
    Form1.SetFormColor('#ffffff',<nowiki>''</nowiki>, clGNone);
  Form1.clSetCaption('Menu List');
    Form1.clSetCaption('Menu List');
 
   
  vScroll = Form1.AddNewVertScrollBox(Form1,'ScrollBoxY');
    vScroll = Form1.AddNewVertScrollBox(Form1,'ScrollBoxY');
  vScroll.Align = alMostTop;
    vScroll.Align = alMostTop;
  vScroll.Height = Form1.clheight-70;
    vScroll.Height = Form1.clheight-70;
 
   
  for (i = 0 to 4)
    for (i = 0 to 4)
  {
    {
    btnS = Form1.AddNewProButton(vScroll,BtnNameArr[i],BtnCaptionArr[i]);
      btnS = Form1.AddNewProButton(vScroll,BtnNameArr[i],BtnCaptionArr[i]);
    btnS.Align = AlTop;
      btnS.Align = AlTop;
    btnS.Height = 150;
      btnS.Height = 150;
    btnS.Margins.Bottom = 5;
      btnS.Margins.Bottom = 5;
    btnS.clProSettings.IsFill = True;
      btnS.clProSettings.IsFill = True;
    btnS.clProSettings.FontSize = 14;
      btnS.clProSettings.FontSize = 14;
    btnS.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
      btnS.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
    btnS.clProSettings.TextSettings.Font.Style = [fsBold,fsItalic];
      btnS.clProSettings.TextSettings.Font.Style = [fsBold,fsItalic];
    btnS.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4287f5');
      btnS.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4287f5');
    btnS.clProSettings.FontVertAlign = palLeading;
      btnS.clProSettings.FontVertAlign = palLeading;
    btnS.clProSettings.FontHorzAlign = palcenter;
      btnS.clProSettings.FontHorzAlign = palcenter;
    btnS.clProSettings.PictureSource =btnImgArr[i];
      btnS.clProSettings.PictureSource =btnImgArr[i];
    btnS.clProSettings.PictureAutoFit = True;
      btnS.clProSettings.PictureAutoFit = True;
    btnS.SetclProSettings(btnS.clProSettings);
      btnS.SetclProSettings(btnS.clProSettings);
    btnS.Hint = BtnNameArr[i];
      btnS.Hint = BtnNameArr[i];
    Form1.AddNewEvent(btnS,tbeOnClick,'BtnOnClick');
      Form1.AddNewEvent(btnS,tbeOnClick,'BtnOnClick');
  }
    }
 
   
  Form1.Run;
    Form1.Run;
}
  }
</pre>


:'''Base Syntax'''
  var
    Form1: TclStyleForm;
    btnS : TclProButton;
    vScroll:TCLVertScrollBox;
    BtnCaptionArr,BtnNameArr,btnImgArr  : array of String;
    i : Integer;
 
  procedure BtnOnClick;
  var
    clickedBtn:TClProButton;
  begin
    clickedBtn := TClProButton(Form1.Clsender);
    ShowMessage(clickedBtn.Caption);
    ShowMessage(clickedBtn.Hint);
 
  end;
 
  begin
    BtnNameArr := ['btnVegetables','btnFruits','btnBeverages','btnMeatTypes','btnCakes'];
    BtnCaptionArr := ['Vegetables','Fruits','Beverages','Meat Types','Cakes'];
    btnImgArr := ['https://clomosy.com/demos/aubergine.png',
    'https://clomosy.com/demos/watermelon.png',
    'https://clomosy.com/demos/fruitJuice.png',
    'https://clomosy.com/demos/meat.png',
    'https://clomosy.com/demos/cake.png'];
    Form1 := TclStyleForm.Create(Self);
    Form1.SetFormColor('#ffffff',<nowiki>''</nowiki>, clGNone);
    Form1.clSetCaption('Menu List');
   
    vScroll := Form1.AddNewVertScrollBox(Form1,'ScrollBoxY');
    vScroll.Align := alMostTop;
    vScroll.Height := Form1.clheight-70;
   
    for i := 0 to 4 do
    begin
      btnS := Form1.AddNewProButton(vScroll,BtnNameArr[i],BtnCaptionArr[i]);
      btnS.Align := AlTop;
      btnS.Height := 150;
      btnS.Margins.Bottom := 5;
      btnS.clProSettings.IsFill := True;
      btnS.clProSettings.FontSize := 14;
      btnS.clProSettings.FontColor := clAlphaColor.clHexToColor('#000000');
      btnS.clProSettings.TextSettings.Font.Style := [fsBold,fsItalic];
      btnS.clProSettings.BackgroundColor := clAlphaColor.clHexToColor('#4287f5');
      btnS.clProSettings.FontVertAlign := palLeading;
      btnS.clProSettings.FontHorzAlign := palcenter;
      btnS.clProSettings.PictureSource := btnImgArr[i];
      btnS.clProSettings.PictureAutoFit := True;
      btnS.SetclProSettings(btnS.clProSettings);
      btnS.Hint := BtnNameArr[i];
      Form1.AddNewEvent(btnS,tbeOnClick,'BtnOnClick');
    end;
   
    Form1.Run;
  end;


'''Output:'''<br>
<b>Output:</b><br>
[[File:MenuList.png|400px|frameless]]
[[File:MenuList.png|400px|frameless]]<br>


= See Also =
<h2> See Also </h2>
* [[Components]]
* [[Object Properties]]
* [[Object Properties]]
* [[AddNewEvent]]
* [[AddNewEvent]]

Revision as of 10:11, 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 vertscrollbox should be written.

AddNewVertScrollBox (TClVertScrollBox) create scrolling areas within a form. Applications often need to display more information than will fit in a particular area. Some controls, such as list boxes, notes, and forms, can automatically scroll down their content.

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


Example

In the example, a menu list has been created. The menu list includes headings such as vegetables, fruits, beverages, and types of meat. To enable a scrollable structure, a TCLVertScrollBox was created, containing buttons. When clicked, the specific button that was clicked is identified.

 var
   Form1: TclStyleForm;
   btnS : TclProButton;
   vScroll:TCLVertScrollBox;
   BtnCaptionArr,BtnNameArr,btnImgArr  : array of String;
   i : Integer;
 
 void BtnOnClick; 
 var
   clickedBtn:TClProButton;
 {
   clickedBtn = TClProButton(Form1.Clsender);
   ShowMessage(clickedBtn.Caption);
   ShowMessage(clickedBtn.Hint);
 
 }
 
 {
   BtnNameArr = ['btnVegetables','btnFruits','btnBeverages','btnMeatTypes','btnCakes'];
   BtnCaptionArr = ['Vegetables','Fruits','Beverages','Meat Types','Cakes'];
   btnImgArr = ['https://clomosy.com/demos/aubergine.png',
   'https://clomosy.com/demos/watermelon.png',
   'https://clomosy.com/demos/fruitJuice.png',
   'https://clomosy.com/demos/meat.png',
   'https://clomosy.com/demos/cake.png'];
   Form1 = TclStyleForm.Create(Self);
   Form1.SetFormColor('#ffffff','', clGNone);
   Form1.clSetCaption('Menu List');
   
   vScroll = Form1.AddNewVertScrollBox(Form1,'ScrollBoxY');
   vScroll.Align = alMostTop;
   vScroll.Height = Form1.clheight-70;
   
   for (i = 0 to 4)
   {
     btnS = Form1.AddNewProButton(vScroll,BtnNameArr[i],BtnCaptionArr[i]);
     btnS.Align = AlTop;
     btnS.Height = 150;
     btnS.Margins.Bottom = 5;
     btnS.clProSettings.IsFill = True;
     btnS.clProSettings.FontSize = 14;
     btnS.clProSettings.FontColor = clAlphaColor.clHexToColor('#000000');
     btnS.clProSettings.TextSettings.Font.Style = [fsBold,fsItalic];
     btnS.clProSettings.BackgroundColor = clAlphaColor.clHexToColor('#4287f5');
     btnS.clProSettings.FontVertAlign = palLeading;
     btnS.clProSettings.FontHorzAlign = palcenter;
     btnS.clProSettings.PictureSource =btnImgArr[i];
     btnS.clProSettings.PictureAutoFit = True;
     btnS.SetclProSettings(btnS.clProSettings);
     btnS.Hint = BtnNameArr[i];
     Form1.AddNewEvent(btnS,tbeOnClick,'BtnOnClick');
   }
   
   Form1.Run;
 }


Output:
MenuList.png

See Also