Table of Contents
TrackBar
Trackbar is a slider on the form that allows users to get numeric values by dragging the track. A track bar can set integer values on a continuous range. It is useful for adjusting properties like color, volume and brightness. The user moves the slide indicator by dragging it to a particular location or clicking within the bar.
We can set its Oriantaion to Horizantal or Vertial. We can setMin, Max and its Value defaults on its properties, or you can set as below.
1 2 3 4 5 |
TrackBar1->Min=0; TrackBar1->Max=20; TrackBar1->Value=5; |
We can read value change by using OnChange() event. To create OnChange() event just double click on it and we can use as below.
1 2 3 4 5 6 7 8 9 10 |
int x; //define global or in the Form1 header in its class as a private or public section. void __fastcall TForm1::TrackBar1Change(TObject *Sender) { x=TrackBar1->Value; } // now our x is changing by the user action, we can use it on other operations |
SpinBox
SpinBox is another method to get numeric values by the value entered or by increase and decrease buttons. it has a special edit box equipped with buttons to increment or decrement. We can setMin, Max and its Value defaults on its properties, or you can set as below.
1 2 3 4 5 |
SpinBox1->Min; SpinBox1->Max=50; SpinBox1->Value=7; |
We can create OnChange() event just double click on it and we can use as below.
1 2 3 4 5 6 7 8 9 |
int x; //define global or in the Form1 header in its class as a private or public section. void __fastcall TForm1::SpinBox1Change(TObject *Sender) { x=SpinBox1->Value; } // now our x is changing by the user action, we can use it on other operations |
ScrollBar
ScrollBars are the most used things on pages to slide view left or right up or down. It represents a standard scroll bar that is used to scroll the contents of a window, form, or a control.
They are generally aligned to controlled thing, to Left or Right in Vertical or Top or Bottom in Horizontal. We can set its Orientation to Horizontal or Vertical. We can set Min, Max and its Value defaults on its properties, or you can set as below.
1 2 3 4 5 |
ScrollBar1->Min=0; ScrollBar1->Max=20; ScrollBar1->Value=5; |
We can create OnChange() event just double click on it and we can use two ScrollBars to get vertical and horizontal x and y parameters as below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
int x,y; //define global or in the Form1 header in its class as a private or public section. void __fastcall TForm1::ScrollBar1Change(TObject *Sender) { x=ScrollBar1->Value; } void __fastcall TForm1::ScrollBar2Change(TObject *Sender) { y=ScrollBar1->Value; } // now our x and y are changing by the user action, we can use it on other operations |
We can create OnChange() event just double click on it and we can use as below.
SmallScrollBar
SmallScrollbar is tiny version of ScrollBar. They are useful in some small areas, hard to change by touch operations. It represents a standard scroll bar that is used to scroll the contents of a window, form, or a control.
They are generally aligned to controlled thing, to Left or Right in Vertical or Top or Bottom in Horizontal. We can set its Orientation to Horizontal or Vertical. We can set Min, Max and its Value defaults on its properties, or you can set as below.
1 2 3 4 5 |
SmallScrollBar1->Min=0; SmallScrollBar1->Max=50; SmallScrollBar1->Value=7; |
We can create OnChange() event just double click on it and we can use two SmallScrollBars to get vertical and horizontal x and y parameters as below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
int x,y; //define global or in the Form1 header in its class as a private or public section. void __fastcall TForm1::SmallScrollBar1Change(TObject *Sender) { x=SmallScrollBar1->Value; } void __fastcall TForm1::SmallScrollBar2Change(TObject *Sender) { y=SmallScrollBar2->Value; } // now our x and y are changing by the user action, we can use it on other operations |
ArcDial
TArcDial is a general-purpose knob-style rotating button. We can use it as button in applications wherever you need to provide the user with a rotating button that resembles a knob. This arc dial control variates its Value in degrees, so if you want to use it as a linear control for varying the progress of a progress bar, for instance, you need to programmatically make a conversion from degrees to linear movement.
1 2 3 4 5 |
ArcDial1->Min=0; ArcDial1->Max=50; ArcDial1->Value=7; |
We can create OnChange() event just double click on it and we can use to get parameters as below.
1 2 3 4 5 6 7 8 9 |
int x; //define global or in the Form1 header in its class as a private or public section. void __fastcall TForm1::ArcDial1Change(TObject *Sender) { x=ArcDial1->Value; } // now our x is changing by the user action, we can use it on other operations |