RAD Studio |  |

Types of controls
Collapse All
Topics

Name | Description
Value List Editors (VCL Only) | TValueListEditor is a specialized grid for editing string lists that contain name/value pairs in the form Name=Value. The names and values are stored as a TStrings descendant that is the value of the Strings property. You can look up the value for any name using the Values property. TValueListEditor is not available for cross-platform programming. The grid contains two columns, one for the names and one for the values. By default, the Name column is named "Key" and the Value column is named "Value". You can change these defaults by setting the TitleCaptions property. You can omit these titles using... more
Animation Control | The animation component is a window that silently displays an Audio Video Interleaved (AVI) clip (VCL applications). An AVI clip is a series of bitmap frames, like a movie. Although AVI clips can have sound, animation controls work only with silent AVI clips. The files you use must be either uncompressed AVI files or AVI clips compressed using run-length encoding (RLE). Following are some of the properties of an animation component: ResHandle is the Windows handle for the module that contains the AVI clip as a resource. Set ResHandle at runtime to the instance handle or module handle of the... more
Bevels | The bevel component (TBevel) is a line that can appear raised or lowered. Some components, such as TPanel, have built-in properties to create beveled borders. When such properties are unavailable, use TBevel to create beveled outlines, boxes, or frames.
Bitmap Buttons | A bitmap button (TBitBtn) is a button control that presents a bitmap image on its face. To choose a bitmap for your button, set the Glyph property. Use Kind to automatically configure a button with a glyph and default behavior. By default, the glyph appears to the left of any text. To move it, use the Layout property. The glyph and text are automatically centered on the button. To move their position, use the Margin property. Margin determines the number of pixels between the edge of the image and the edge of the button. By default, the image... more
Button Controls | Users click button controls to initiate actions. You can assign an action to a TButton component by creating an OnClick event handler for it. Double-clicking a button at design time takes you to the button's OnClick event handler in the Code editor. Set Cancel to True if you want the button to trigger its OnClick event when the user presses Esc. Set Default to True if you want the Enter key to trigger the button's OnClick event.
Buttons and Similar Controls | Aside from menus, buttons provide the most common way to initiate an action or command in an application. Button-like controls include:
Check Boxes | A check box is a toggle that lets the user select an on or off state. When the choice is turned on, the check box is checked. Otherwise, the check box is blank. You create check boxes using TCheckBox. Set Checked to True to make the box appear checked by default. Set AllowGrayed to True to give the check box three possible states: checked, unchecked, and grayed. The State property indicates whether the check box is checked (cbChecked), unchecked (cbUnchecked), or grayed (cbGrayed). Note: Check box controls display one of two binary states.... more
Combo Boxes | A combo box (TComboBox) combines an edit box with a scrollable list. When users enter data into the control—by typing or selecting from the list—the value of the Text property changes. If AutoComplete is enabled, the application looks for and displays the closest match in the list as the user types the data. Three types of combo boxes are: standard, drop-down (the default), and drop-down list.
Cool Bars (VCL Only) | A cool bar contains child controls that can be moved and resized independently. Each control resides on an individual band. The user positions the controls by dragging the sizing grip to the left of each band. The cool bar requires version 4.70 or later of COMCTL32.DLL (usually located in the Windows\System or Windows\System32 directory) at both design time and runtime. Cool bars cannot be used in cross-platform applications. The Bands property holds a collection of TCoolBand objects. At design time, you can add, remove, or modify bands with the Bands editor. To open the Bands editor, select the... more
Draw Grids | A draw grid (TDrawGrid) displays arbitrary data in tabular format. Write an OnDrawCell event handler to fill in the cells of the grid. The CellRect method returns the screen coordinates of a specified cell, while the MouseToCell method returns the column and row of the cell at specified screen coordinates. The Selection property indicates the boundaries of the currently selected cells. The TopRow property determines which row is currently at the top of the grid. The LeftCol property determines the first visible column on the left. VisibleColCount and VisibleRowCount are the number of columns and rows visible in... more
Graphic Controls | The following components make it easy to incorporate graphics into an application.
Group Boxes and Radio Groups | A group box (TGroupBox) arranges related controls on a form. The most commonly grouped controls are radio buttons. After placing a group box on a form, select components from the Tool palette and place them in the group box. The Caption property contains text that labels the group box at runtime. The radio group component (TRadioGroup) simplifies the task of assembling radio buttons and making them work together. To add radio buttons to a radio group, edit the Items property in the Object Inspector; each string in Items makes a radio button appear in the... more
Grouping Controls | A graphical interface is easier to use when related controls and information are presented in groups. Components for grouping components include:
List Controls | Lists present the user with a collection of items to select from. Several components display lists:
Header Controls | A header control (THeaderControl) is a is a set of column headers that the user can select or resize at runtime. Edit the control's Sections property to add or modify headers. You can place the header sections above columns or fields. For example, header sections might be placed over a list box (TListBox).
Help and Hint Properties | Most visual controls can display context-sensitive Help as well as fly-by hints at runtime. The HelpContext and HelpFile properties establish a Help context number and Help file for the control. The Hint property contains the text string that appears when the user moves the mouse pointer over a control or menu item. To enable hints, set ShowHint to True; setting ParentShowHint to True causes the control's ShowHint property to have the same value as its parent's.
Hot Key Controls (VCL Only) | Use the hot key component (THotKey) to assign a keyboard shortcut that transfers focus to any control. The HotKey property contains the current key combination and the Modifiers property determines which keys are available for HotKey. The hot key component can be assigned as the ShortCut property of a menu item. Then, when a user enters the key combination specified by the HotKey and Modifiers properties, Windows activates the menu item.
Images | The image component (TImage) displays a graphical image, like a bitmap, icon, or metafile. The Picture property determines the graphic to be displayed. Use Center, AutoSize, Stretch, and Transparent to set display options. For more information, see Overview of Graphics Programming.
Labels | Labels display text and are usually placed next to other controls.
List Boxes and Check-list Boxes | List boxes (TListBox) and check-list boxes display lists from which users can select one or more choices from a list of possible options. The choices are represented using text, graphics, or both. Items uses a TStrings object to fill the control with values. ItemIndex indicates which item in the list is selected. MultiSelect specifies whether a user can select more than one item at a time. Sorted determines whether the list is arranged alphabetically. Columns specifies the number of columns in the list control. IntegralHeight specifies whether the list box shows only entries that fit completely in the... more
List Views | List views, created using TListView, display lists in various formats. Use the ViewStyle property to choose the kind of list you want: vsIcon and vsSmallIcon display each item as an icon with a label. Users can drag items within the list view window (VCL only). vsList displays items as labeled icons that cannot be dragged. vsReport displays items on separate lines with information arranged in columns. The leftmost column contains a small icon and label, and subsequent columns contain subitems specified by the application. Use the ShowColumnHeaders property to display headers for the columns.
Memo and Rich Edit Controls | Both the TMemo and TRichEdit controls handle multiple lines of text. TMemo is another type of edit box that handles multiple lines of text. The lines in a memo control can extend beyond the right boundary of the edit box, or they can wrap onto the next line. You control whether the lines wrap using the WordWrap property. TRichEdit is a memo control that supports rich text formatting, printing, searching, and drag-and-drop of text. It allows you to specify font properties, alignment, tabs, indentation, and numbering. Note: The rich edit control is available for VCL applications only. In addition to... more
Page Controls | The page control component (TPageControl) is a page set suitable for multipage dialog boxes. A page control displays multiple overlapping pages that are TTabSheet objects. A page is selected in the user interface by clicking a tab on top of the control. To create a new page in a page control at design time, right-click the control and choose New Page. At runtime, you add new pages by creating the object for the page and setting its PageControl property:
Paint Boxes | The paint box (TPaintBox) allows your application to draw on a form. Write an OnPaint event handler to render an image directly on the paint box's Canvas. Drawing outside the boundaries of the paint box is prevented. For more information, see Overview of Graphics Programming.
Panels | The TPanel component provides a generic container for other controls. Panels are typically used to visually group components together on a form. Panels can be aligned with the form to maintain the same relative position when the form is resized. The BorderWidth property determines the width, in pixels, of the border around a panel. You can also place other controls onto a panel and use the Align property to ensure proper positioning of all the controls in the group on the form. You can make a panel alTop aligned so that its position will remain in place even if the... more
Progress Bars | When your application performs a time-consuming operation, you can use a progress bar (TProgressBar) to show how much of the task is completed. A progress bar displays a dotted line that grows from left to right. The Position property tracks the length of the dotted line. Max and Min determine the range of Position. To make the line grow, increment Position by calling the StepBy or StepIt method. The Step property determines the increment used by StepIt.
Radio Buttons | Radio buttons, also called option buttons, present a set of mutually exclusive choices. You can create individual radio buttons using TRadioButton or use the radio group component (TRadioGroup) to arrange radio buttons into groups automatically. You can group radio buttons to let the user select one from a limited set of choices. See Grouping Controls for more information. A selected radio button is displayed as a circle filled in the middle. When not selected, the radio button shows an empty circle. Assign the value True or False to the Checked property to change the radio button's visual state.... more
Scroll Bars | The scroll bar component creates a scroll bar that you can use to scroll the contents of a window, form, or other control. In the OnScroll event handler, you write code that determines how the control behaves when the user moves the scroll bar. The scroll bar component is not used very often, because many visual components include scroll bars of their own and thus don't require additional coding. For example, TForm has VertScrollBar and HorzScrollBar properties that automatically configure scroll bars on the form. To create a scrollable region within a form, use TScrollBox.
Scroll Boxes | Scroll boxes (TScrollBox) 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, memos, and forms themselves—can automatically scroll their contents. Another use of scroll boxes is to create multiple scrolling areas (views) in a window. Views are common in commercial word-processor, spreadsheet, and project management applications. Scroll boxes give you the additional flexibility to define arbitrary scrolling subregions of a form. Like panels and group boxes, scroll boxes contain other controls, such as TButton and TCheckBox objects. But a scroll box is... more
Shapes | The shape component displays a geometric shape. It is a nonwindowed control and therefore, cannot receive user input. The Shape property determines which shape the control assumes. To change the shape's color or add a pattern, use the Brush property, which holds a TBrush object. How the shape is painted depends on the Color and Style properties of TBrush.
Specialized Input Controls | The following components provide additional ways of capturing input.
Speed Buttons | Speed buttons (TSpeedButton), which usually have images on their faces, can function in groups. They are commonly used with panels to create toolbars. To make speed buttons act as a group, give the GroupIndex property of all the buttons the same nonzero value. By default, speed buttons appear in an up (unselected) state. To initially display a speed button as selected, set the Down property to True. If AllowAllUp is True, all of the speed buttons in a group can be unselected. Set AllowAllUp to False if you want a group of buttons to act like a radio... more
Splitter Controls | A splitter (TSplitter) placed between aligned controls allows users to resize the controls. Used with components like panels and group boxes, splitters let you divide a form into several panes with multiple controls on each pane. After placing a panel or other control on a form, add a splitter with the same alignment as the control. The last control should be client-aligned, so that it fills up the remaining space when the others are resized. For example, you can place a panel at the left edge of a form, set its Alignment to alLeft, then place a... more
Status Bars | Although you can use a panel to make a status bar, it is simpler to use the TStatusBar component. By default, the status bar's Align property is set to alBottom, which takes care of both position and size. If you only want to display one text string at a time in the status bar, set its SimplePanel property to True and use the SimpleText property to control the text displayed in the status bar. You can also divide a status bar into several text areas, called panels. To create panels, edit the Panels property in the Object Inspector,... more
String Grids | The string grid component is a descendant of TDrawGrid that adds specialized functionality to simplify the display of strings. The Cells property lists the strings for each cell in the grid; the Objects property lists objects associated with each string. All the strings and associated objects for a particular column or row can be accessed through the Cols or Rows property.
Tab Controls | The tab control component (TTabControl) creates a set of tabs that look like notebook dividers. You can create tabs by editing the Tabs property in the Object Inspector; each string in Tabs represents a tab. The tab control is a single panel with one set of components on it. To change the appearance of the control when the tabs are clicked, you need to write an OnChange event handler. To create a multipage dialog box, use a page control instead.
Grids | Grids display information in rows and columns. If you're writing a database application, use the TDBCtrlGrid or TDBCtrlGrid component. Otherwise, use a standard draw grid or string grid.
Edit Controls | Edit controls display text to the user and allow the user to enter text. The type of control used for this purpose depends on the size and format of the information.
Toolbar Controls | Toolbars provide an easy way to arrange and manage visual controls. You can create a toolbar out of a panel component and speed buttons, or you can use the TToolBar component, then right-click and choose New Button to add buttons to the toolbar. The TToolBar component has several advantages: buttons on a toolbar automatically maintain uniform dimensions and spacing; other controls maintain their relative position and height; controls can automatically wrap around to start a new row when they do not fit horizontally; and TToolBar offers display options like transparency, pop-up borders, and spaces and dividers to group controls. You... more
Track Bars | 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. Use the Max and Min properties to set the upper and lower range of the track bar. Use SelEnd and SelStart to highlight a selection range. The Orientation property determines whether the track bar is vertical or horizontal. By default, a track bar has one row of ticks along the bottom. Use the TickMarks property to change their location. To... more
Tree Views | A tree view (TTreeView) displays items in an indented outline. The control provides buttons that allow nodes to be expanded and collapsed. You can include icons with items' text labels and display different icons to indicate whether a node is expanded or collapsed. You can also include graphics, such as check boxes, that reflect state information about the items. Indent sets the number of pixels horizontally separating items from their parents. ShowButtons enables the display of "+" and "–" buttons to indicate whether an item can be expanded. ShowLines enables display of connecting lines to show hierarchical relationships... more
Up-down Controls (VCL Only) | In VCL applications only, an up-down control (TUpDown) consists of a pair of arrow buttons that allow users to change an integer value in fixed increments. The current value is given by the Position property; the increment, which defaults to 1, is specified by the Increment property. Use the Associate property to attach another component (such as an edit control) to the up-down control.
Display Controls | There are many ways to provide users with information about the state of an application. For example, some components—including TForm—have a Caption property that can be set at runtime. You can also create dialog boxes to display messages. In addition, the following components are especially useful for providing visual feedback at runtime to identify the object.
Text Controls | Many applications use text controls to display text to the user. You can use: Edit controls, which allow the user to add text. Text viewing controls and labels, which do not allow user to add text.
Text Viewing Controls |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!