From Clomosy Docs
ClomosyAdmin (talk | contribs) No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
|- | |- | ||
|AddNewHorzScrollBox || HorzScrollBox1 = Form1.AddNewHorzScrollBox(Form1,'testHorzScrollBox'); || A new TclHorzScrollBox is added to the form. | |AddNewHorzScrollBox || HorzScrollBox1 = Form1.AddNewHorzScrollBox(Form1,'testHorzScrollBox'); || A new TclHorzScrollBox is added to the form. | ||
|- | |||
|ScrollBy(DeltaX,DeltaY: Integer); || HorzScrollBox1.ScrollBy(-100,0); || To scroll the contents within the control, call ScrollBy.<br> | |||
The DeltaX parameter is the change in pixels along the X-axis.<br> | |||
A positive DeltaX value scrolls the content to the left; a negative value scrolls the content to the right.<br> | |||
The DeltaY parameter is the change in pixels along the Y-axis.<br> | |||
A positive DeltaY value scrolls the content upward; a negative value scrolls the content downward. | |||
|- | |||
|ScrollTo(X,Y: Integer); || HorzScrollBox1.ScrollTo(-100,0); || To scroll the contents within the control, call ScrollTo.<br> | |||
The X parameter is the change in pixels along the X-axis.<br> | |||
A positive X value scrolls the content to the left; a negative value scrolls the content to the right.<br> | |||
The Y parameter is the change in pixels along the Y-axis.<br> | |||
A positive Y value scrolls the content upward; a negative value scrolls the content downward. | |||
|- | |- | ||
|Width || HorzScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox. | |Width || HorzScrollBox1.Width = 150; ||Allows adjusting the width of the scrollBox. | ||
Latest revision as of 08:30, 24 April 2025
function AddNewHorzScrollBox(AComponent: TCLComponent; xName: string): TclHorzScrollBox;
AComponent : Specifies the parent of the object to be defined.
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. |
| ScrollBy(DeltaX,DeltaY: Integer); | HorzScrollBox1.ScrollBy(-100,0); | To scroll the contents within the control, call ScrollBy. The DeltaX parameter is the change in pixels along the X-axis. |
| ScrollTo(X,Y: Integer); | HorzScrollBox1.ScrollTo(-100,0); | To scroll the contents within the control, call ScrollTo. The X parameter is the change in pixels along the X-axis. |
| 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;
}