Several standard controls used in most Lazarus forms The case of text displayed in an edit box or combobox. Normal mode - no conversion. Converts every entered character to upper case. Converts every entered character to lower case. How text in the edit box is displayed. Characters are shown unmodified. All characters shown as spaces. All characters shown as PasswordChar. The appearance of scroll bars on a control. No scrollbars. A horizontal scrollbar is shown. A vertical scrollbar is shown. Both horizontal and vertical scrollbars are shown. A horizontal scrollbar is shown when needed. A vertical scrollbar is shown when needed. Both scrollbars are shown as needed. The scroll action type, as reported by the widget.

These values must correspond to the SB_xxx values in LCLType.

Scroll one line up (column left). Scroll one line down (column right). Scroll one page up (left). Scroll one page down (right). Scroll to the specified position. Scroll tracking to the specified position. Scroll to the top (left) end. Scroll to the bottom (right) end. Scrolling finished. Handler type for scrolling events. The handler is called before the new Position is set. It can adjust the new position, based on the parameters and the (old) scrollbar.Position. The scrollbar The scroll action. The suggested new scroll position. Change this value to implement custom scroll behaviour. The base class for TScrollBar. The parameter list. CreateWnd - calls inherited CreateWnd then initialises various Scroll Info properties

The inherited method creates the interface object, sets parameters and assigns the handle

Then the size of scrollbar, maximum and minimum values, page size and position of scrollbar are set

TWinControl.CreateWnd
Invokes the OnChange handler. TControl.Changed Invokes the OnScroll handler. The code used for scrolling - up or down a line, a page, to the top or bottom etc The position of the scrolling device Defines the Max and Min values, the size of the page and the position of the scroller The scrollbar orientation, horizontal or vertical. The distance to scroll on an click beneath the slider. A large change is produced by clicks on the blank area above or below the slider; it is rather analogous to the Page Down or Page Up functions of the Keyboard, and is typically set up to move the slider and the control contents by a full page (window size). The maximum value, for the bottom or rightmost position. The minimum value, for the top or leftmost position. The size of the slider, relative to the total scroll range. The position value of the slider in the ScrollBar. The distance to scroll on an click on the up/down buttons. A small change occurs when the up or down buttons are clicked, or by up/down keyboard commands. It is typically used for scrolling by a few pixels, or by a single row or column of text. Event handler for any change of the Position. Handler for a scrolling event by mouse, keyboard or code.

The handler can override the new position, based on the scrolling parameters.

A control that allows the user to scroll the content of an associated control by moving an slider.

A control that allows the user to scroll the content of a window, by moving an slider.

It appears as a long rectangular track bar, within which a smaller contrasting block or slider can move up and down (or from side to side in a horizontal ScrollBar).

It has small triangular indicators or pointers on one or both ends of the bar, depending on the widgetset. Clicking with the mouse on one of the pointers moves the slider a small distance (SmallChange) in the specified direction.

Clicking with the mouse in the blank area of the scrollbar above or below the slider makes the slider move by a larger increment (LargeChange).

The slider can also be moved by clicking on it with the mouse, and holding down the button while moving the mouse. The slider then follows the mouse until the button is released.

If the mouse has a scrollwheel, the slider also can be moved by rotating the wheel.

The arrow keys or the Page Up/Page Down keys on the keyboard can be used to move the slider, too.

The location of the slider along the track is held in the Position property. It's the programmer's responsibility to ensure that the content of the window is scrolled to the new Position of the scrollbar.

The base class for TGroupBox, TRadioGroup and TCheckGroup. A container that allows a number of objects to be grouped physically and conceptually on a form.

The objects can be moved around together and have certain properties in common.

The text displayed in the border around the box. Defines the behavior of the AutoComplete feature in a combobox control.
  • cbactEnabled: Enable Auto-Completion feature.
  • cbactEndOfLineComplete: Perform Auto-Complete only when cursor is at the end of the string.
  • cbactRetainPrefixCase: Retains the case of characters user has typed. (This option has no effect if cbactEndOfLineComplete is False)
  • cbactSearchCaseSensitive: Search completion string with case sensitivity.
  • cbactSearchAscending: Search completion string in ascending order. (False will search in descending order)
Enable Auto-Completion feature. Perform Auto-Complete only when cursor is at the end of the string. Retains the case of characters user has typed. This option has no effect if cbactEndOfLineComplete is not set. Search completion string with case sensitivity. Search completion strings in ascending order, if set. Otherwise search in descending order. Set of TComboBoxAutoCompleteTextOption. Set of [cbactEndOfLineComplete, cbactSearchAscending] The styles of a combobox. The box has a drop-down list. The box has a fixed size list. The box has a drop-down list, from which entries can be selected (manual text entry disabled). The drop-down list elements are owner drawn and have a common fixed height. The drop-down list elements are owner drawn and have an individual height. The handler type for painting a single item of owner-draw list and combo boxes. The control to draw. Index of the item to draw. The item rectangle in the Canvas. Flags describing the item state to draw (selected...). The handler type for the determination of the Height of a single item in owner-draw list and combo boxes. The list or combo box. Index of the item to measure. Here the handler returns the Height of the item (in pixels). The base class for ComboBox components.

A ComboBox combines an edit box with an item list. The list can be either static (always visible), or drops down when needed.

Depending on the ComboBox Style the user can type text into the edit box, or he can select items from the Items list.

Despite similarities in appearance to TCustomEdit and TCustomList, the class inherits no properties from these classes (Delphi compatible).

It has some interesting properties including AutoComplete and AutoCompleteText, AutoDropDown and the ability to create and add a History display.

Used internally, to return the state of arrow keys from temporary change. Handler for custom drawing items, invokes DrawItem. Determines the height of an item, using MeasureItem in variable owner-draw mode. Invokes the OnSelect handler. Invokes the OnDropDown or OnCloseUp handlers. Handles changes of the Sorted property. Prevents ordinary chars from triggering accelerators. Selects the entire text when AutoSelect is True. TWinControl.DoEnter Clears AutoSelect, then calls inherited DoExit TWinControl.DoExit Draws an item, using the OnDrawItem handler if one is installed.

Software emulation of OnDrawItem event, in OwnerDraw mode.

Calls the OnDrawItem handler, if installed. Otherwise default painting is performed (InternalDrawItem).

The item to draw. The area to paint in the Canvas. The state of the item (selected...). Invokes the OnMeasureItem handler, to get the height of the item in the drop-down list. The index of the item whose height is required. The height of the item, in pixels, adjustable by the OnMeasureItem handler. Notification of a change in the edit box. Invokes the OnChange handler, signaling an change in the edit box. Invokes the OnSelect handler. Called whenever the user changes the ItemIndex. For Delphi compatibility ignore when user unselects by changing Text. Invokes the OnDropDown handler. Called whenever the list drops down. Invokes the OnGetItems handler. Called whenever the list hides. Handles selection in the edit box, also invokes the OnEditingDone and OnCloseUp handlers. Adjusts the extent of the DropDown list. Returns the number of list items. The Items.Count. Adjusts ItemIndex according to the new edit box content.

If the text AValue occurs in the list of strings, then sets the Itemindex, otherwise does the default action which is to store text as a string rather than performing read-write to a PChar buffer

TControl.RealSetText
The new content of the edit box. Filters TAB and RETURN key when used to traverse the list.

The inherited method provides software emulation of the event handler OnKeyDown which acts if a key has been pressed and is still down

TWinControl.KeyDown
The pressed key. The state of the modifier keys and mouse buttons. Handles AutoSelect and AutoComplete. Adjusts character case before further processing.

The inherited method invokes the OnKeyPress handler, allowing for further input processing.

TWinControl.KeyPress
UTF8KeyPress converts character case if required then calls inherited method TWinControl.UTF8KeyPress

The inherited method emulates the pressing of a key, with UTF8 coding. The UTF8 coding should be used where there is the possibility that input/output will occur in any language that requires multiple bytes to represent each character, i.e. all languages except English.

AutoSelect when left mouse is clicked for the 1st time after having focus. AutoSelect TControl.MouseUp Selects the item with the given text. When a matching item was found, invokes the OnClick and OnSelect handlers. OnClick OnSelect True when a matching item was found and selected. The text to find in Items. Called whenever the items can be just-in-time populated. Gets list of items from the interface. Invokes GetItems, which calls the OnGetItems handler. Adds an item to the Items list. The item text. The associated object, can be Nil. Add an item as the first entry in History List.

When the item is already in the history list, it is moved to the begin of the list.

Otherwise the item is added as the first entry; when the list is full, the last item is removed.

The string to be added to the list. The maximum number of items that can be added to the history. When True the string also is copied into the edit box. True means that the list can contain multiple items with the same text, differing in case. The object associated with the item; can be Nil. Removes all items from the list, clears the edit box. Unselect a possibly selected item (ItemIndex becomes -1). The text selection is not affected. Set SelLength to zero to remove a selection from the text box. Select the entire text in the edit box. Allows the operator to use also the keyboard Arrow keys to move through the list. Allows to select items from partial input, of the begin of the item text. The first matching item is selected. The user can continue entering characters, until the desired (or no) matching item is selected. Options for the behavior of the Auto-Complete feature.
  • Enabled: Enable Auto-Completion feature.
  • EndOfLineComplete: Perform Auto-Complete only when cursor is at the end of the string.
  • RetainPrefixCase: Retains the case of characters user has typed. (This option has no effect if cbactEndOfLineComplete is False)
  • SearchCaseSensitive: Search completion string with case sensitivity.
  • SearchAscending: Search completion string in accending order. (False will search in descending order)

This property exists as a Set of Options, so zero or more options may be operational

Makes the drop-down list appear as soon as the user starts entering text.

If False, the drop-down list only appears when the down button to the right of the edit box is clicked.

Selects the entire content of the edit box when the control receives the focus.

When True, the edit control will select all its text when:

  • It receives focus
  • The Enter key is pressed.
  • A new item is selected.
True indicates that the selection was marked automatically by the control.

True indicates that the combobox control has just performed an AutoSelect operation so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text.

False is set when the combobox control loses focus.

Indicates how text is converted during input (upper, lower, or as entered). Indicates whether the drop-down list has appeared. Setting this property opens or closes the drop-down list. The height of the drop-down list, measured in number of items. The default height of a list item. In owner-draw mode the value can be adjusted by the application, otherwise it is determined by the widget. The index of the currently selected item, -1 if none is selected.

Setting the ItemIndex selects the item in the list.

The first list item has index 0, up to ListCount-1.

If no item is selected, ItemIndex is -1.

The list of all items in the control.

The Items strings are displayed in the static or drop-down list of the control.

Reading allows to access the contents of the list (TStrings compatible).

Assign another string list to replace the items.

The minimum width of the items in the drop-down list. The maximum length of user input. Set MaxLength to e.g. the fixed length of a string field, where the input is stored later. Event handler for user changed text in the edit box.

This event covers only changes made by the user, not by code. Note that this differs from how other OnChange events work, for example TEdit.OnChange is triggered by code text changes. This event is also triggered when the selection is changed by using the combo box list.

Handler invoked when the drop-down list closes. Handler for special painting of an item (in owner-draw mode). Handler invoked when the list has dropped down. Handler invoked when widgetset items list can be populated

Some widgetsets like gtk call this just before the list drops down, while others do it on handle creation. This event allows to handle both cases with one event.

Handler invoked when the height of an item is required. Handler invoked when an item is selected. Disallows entry of free text. When True, only items from the list are accepted, by direct selection from the list or AutoComplete. The number of selected UTF-8 characters in the edit box. The zero-based index of the begin of the selection in the edit box.

If text is selected, this is the starting position, otherwise the cursor position.

When no text is selected, SelStart is the cursor position, and SelLength=0.

Writing moves the cursor, and removes the selection. Set SelLength after changing SelStart, to establish a new selection.

SelStart is a zero-based index into Text, in contrast to usual 1-based string indices.

The selected text in the edit box. Assign an new string to replace the selected text. Determines whether the list entries are sorted. Setting this property to True enforces ascending alphanumeric case-insensitive sorting of the list. When True, new entries are added in sort order, not to the end of the list. Appearance and behaviour of the ComboBox (static/drop-down, owner-draw...).

The Style is quite Windows centric, reflecting the evolution of ComboBox styles.

Basic styles are

  • csSimple: edit box with a static list (no drop-down).
  • csDropDown: edit box with a drop-down list.
  • csDropDownList: strings can not be entered by the user, only selected from the drop-down list.

Later owner-drawn drop-down lists have been added, with

  • csOwnerDrawFixed: all items in the drop-down list have the same height.
  • csOwnerDrawVariable: every item can have a different height.

The ReadOnly property affects the edit box behaviour even in the owner-draw styles.

The string appearing in the edit box.

Setting Text selects a possibly matching item in the list.

If an item is selected from the list, it replaces the contents of Text.

Free user input can be disallowed by the ReadOnly property, so that only strings from the list can be selected.

Text completion can be established by the AutoComplete property.

A combination of an edit box and a (drop-down) list allowing one of several options to be chosen.

The Text property reflects the text entered into the edit box, or selected from the list.

The selectable values are kept in the Items list. Clicking on the ellipsis (...), next to Items in the Object Inspector, opens an editor which allows the designer to populate the Items list.

At run-time, the entry selected from the list replaces the text in the edit box, and ItemIndex holds the (zero-based) index number of the selected item.

If no value is selected from the drop-down list, the default text (if any) remains, or any information typed directly into Text will be returned, and ItemIndex takes the value of -1

Determines how items are drawn in a ListBox. Items drawn by the widget. Items drawn by user code, all items have the same height. Items drawn by user code, every item can have a different height. Handler type for change notifications from a ListBox. The ListBox control. True if the user changed the selection, False if changed by code. The base class for TListBox. Copy selection state into the cache. Sends the cached selection state to the widget. Determine the standard Height of the items, when no widget has yet been created. Sends the predefined ItemIndex to the widget. TComponent.Loaded TWinControl.Loaded Copies the Items into the widget. TWinControl.InitializeWnd Caches the Items stored in the widget. TWinControl.FinalizeWnd Assures that the index is inside the Items list bounds. Raises an IndexOutOfBounds exception when the index is out of bounds. The selection state of the item. Returns the size of a cached item. Returns an pointer to the cached item data. Raises an InvalidOperation exception when the cache is invalid, i.e. when the widget has been created. Paints an item in owner-draw mode. Invokes the OnSelectionChange handler. Sends the ItemIndex to the widget. Adds an item to the list. The item text. The associated object, can be Nil. Removes all items from the list. Unselects all items. Find the item at the given client coordinates. The item index, -1 if no item could be found. The X client coordinate. The Y client coordinate. The item index, -1 if no item could be found. The Y client coordinate. Get the text of all selected items in one string. The item strings, one per line. Get the item index for the given client coordinates. The calculated item index, can be out of the Items bounds. The item position. True when the index is requested for insertion of a new item. Returns the client area of an item (including scrolling). Only an index from 0 to ItemCount is considered valid, i.e. the result is valid also for the next item, that will be added subsequently. The item area; all zeroes for an invalid item index. The tentative item index. Returns True if the item is at least partially visible in the scrolled list. Returns True if the item is fully visible in the scrolled list. Blocks selection changes during update of the widget. Makes the item at ItemIndex visible, possibly scrolling the list. Request the Height of a list item, using the OnMeasureItem handler. The item index. The height of the item in pixels, can be changed by the handler. Selects all items in the list (in ExtendedSelect mode). Unlocks previously locked selection changes. Allows selection changes to generate a Click event. Delphi generates an OnClick event when the selection changes. The LCL adds a more specific OnSelectionChange event. Set ClickOnSelChange to False, when selection changes should be handled only in OnSelectionChange, and should not generate an OnClick event (Delphi compatible). The number of visible vertical columns.

A ListBox can have multiple columns, not only multiple rows.

When Columns is greater than zero, it specifies the number of columns that are visible without horizontal scrolling. I.e. the width of a single column becomes Width/Columns.

The number of items in the list. True when a contiguous range of items can be selected by a SHIFT-click. Default True.

Normally a click into the list selects one item, and deselects all other items.

When MultiSelect is True, the user can select/deselect further items with CTRL-click.

When ExtendedSelect also is True, the user can SHIFT-click on an item, to select all items between this and the last selected item.

Not implemented: shrink the Height of the widget, so that it only shows fully visible rows. The default height of all items. The currently selected item, -1 if none. If MultiSelect is True, ItemIndex represents the selected item which also has the focus. The list of all items in the control.

Reading allows to access the contents of the list (TStrings compatible).

Assign another string list to replace the items.

Allows to select more than one Item from the list, using CTRL-click. Handler for special painting of an item (in owner-draw mode). Handler invoked when the height of an item is required. Handler invoked when an item is selected. The virtual width of the ListBox, in pixels. This property determines, how far the listbox can be scrolled horizontally. In a multi-column ListBox it also determines the total number of vertical columns, together with Columns. The number of selected iems in the list. Get or set the Selected state of an item. Determines whether the list entries are sorted. Setting this property to True enforces ascending alphanumeric case-insensitive sorting of the list. When True, new entries are added in sort order, not to the end of the list. Appearance of the ListBox - normal, owner-draw fixed, or owner-draw variable. Index of the first visible (topmost) item. A scrollable list of strings.

The strings are stored in the Items list.

At design time a click on the ellipsis (...) next to the Items entry in the Object Inspector opens an string-list editor, in which the individual text-strings for the list items can be entered or edited. The editor also allows the entries to be sorted alphabetically in normal or reverse order.

The base class for controls presenting editable text.

This class implements various visual attributes of the control and its contained text, as well as simple editing and clipboard operations.

Text attributes (bold, italic...) are not supported.

Invokes the OnEnter handler, then selects the entire text when AutoSelect is True. This special handling is required when the control is entered by keystrokes, not by a mouse click. TWinControl.DoEnter The number of selected UTF-8 characters. Prevents keystrokes from acting as accelerators. Selects the entire text when AutoSelect is True. Deletes all text. Selects the entire text in the control. Deletes (removes) the selected text. Copies the selected text into the clipboard. Moves the selected text into the clipboard (removes it from the control). Inserts text from the clipboard at the current position, possibly replacing the selected text. Reverts the last edit action. The horizontal adjustment of the text - left, right, or centered. If True, the edit control will select all its text when it receives focus or when the Enter key is pressed. True when the text selection was established automatically. Allows to adjust the control to the extent of the contained text. Indicates whether recent changes can be reverted. The position of the text cursor.

Character positions are relative to the string, independent of LTR/RTL display. The position reflects logical (UTF-8) characters.

Position zero is right before the first character.

If there is a selection, the caret is considered to be right after the last selected character.

Allows to force the text into all upper or lower case.

The following conversions can be specified:

  • Unchanged
  • All upper case letters
  • All lower case letters
According conversions apply to the entire text, and can not be reverted.
Allows to modify the text display, useful for entering passwords.

The following conversions can be specified:

  • emNormal: Unchanged
  • emNone: All spaces
  • emPassword: All PasswordChars
According conversions apply to the entire text, and can not be reverted.
Allows to hide the selection, when the control doesn't have the focus. The maximum length of the text; zero for unlimited. In Delphi MaxLength only limits user input. The LCL instead restricts the maximum length of the contained text; this simplifies the implementation for non-Win32 widgetsets. True when the text has changed [how?]. Reset whenever the changed text was stored (saved) by code. Event handler for any change in text. Text changes which trigger OnChange include changing the text programatically and also changing it by the user, for example using the keyboard or a virtual keyboard. Note that some OnChange events in other classes might not be trigerred on programatical changes, for example TComboBox.OnChange. This event should not happen when only starting up a form, without any extra code. Allows to obfuscate the displayed text, showing all characters as PasswordChar.

Typically used in password input, to hide the input from other viewers.

Malware still can read the Text property (WM_GETTEXT), to get the real text.
Prevents the user from changing the text. The number of currently selected characters. The zero-based index of the first character in the selection. The selected text in the edit box. Assign an new string to replace the selected text. The text in the edit box. A ScrollBar for use in Memo Boxes. Scroll Bar specifically for use in Memo Boxes. Inherits most of its properties from its ancestor, TControlScrollBar The base class for multi-line text controls.

The text in a multi-line control can be accessed in two ways:

  • Lines allows access to every single line.
  • Lines.Text represents the entire text as one string.

The overhead involved with every property depends on the internal representation representation of the text, in the widget. In either case multiple changes to the Text property should be done in a local copy, written back after all changes have been applied.

The logical lines (paragraphs) in Lines do not always match the displayed lines. When WordWrap is True, every paragraph can wrap into multiple display lines. [really?]

Returns the contents of Lines.Text, separated by [NewLine?]. TControl.RealGetText The entire text in one string. Replaces Lines.Text. TControl.RealSetText The entire text in one string. Lines are separated by LineFeed (LF) and/or CarriageReturn (CR) characters. Always False, a cache is not implemented. The CachedText of type TCaption that is being fetched Returns the position of the cursor marker or caret Returns the default size, stored as a TPoint Appends a line to the text. The text in the line. An array with one string for every line (paragraph) in the control. The horizontal scroll bar for this control. The vertical scroll bar for this control. Adds vertical and/or horizontal scrollbars to the control. Allows the user to insert Return characters (line breaks) into the text.

The Enter key typically is used to press the default button in a form, so that it cannot be used to add line breaks into the text.

Setting WantReturns to True allows to enter line breaks, when the control has the focus.

Even if WantReturns is False, CTRL-Enter inserts an line break.

Allows to enter Tab characters into the text.

The Tab key is normally used to move the focus to the next control, so that it cannot be used to add Tabs to the text.

When WantTabs is True, the Tab key inserts a Tab character into the text, instead of moving the focus to then next control.

Even if WantTabs is True, the user can Tab into the control, but not out again.

Allows long logical lines (paragraphs) to wrap into multiple display lines. When False, long lines are truncated at the right margin of the control, unless the text can be scrolled horizontally. A control with a single line of editable text. Control for editable multi-line text.

The textual data is held as an array of strings in Lines, where it can be edited

The border style of static text controls. No border. Single line border. Sunken 3-D border. The base class for TStaticText. Defers the focus to FocusControl. Returns the Caption of the control. The Caption text. The horizontal adjustment of the text - centered, left- or right-justified. The border shown around the control. The control that shall receive the focus instead of this control. Makes the accelerator character stand out (underlined) of the displayed text. Makes the control either opaque or transparent. Control to display an constant text.

This control can be used instead of TLabel, when a TWinControl is required.

The text to show. The base class for various button controls. Invokes the OnChange handler. The state of the check mark. Here always False, can be implemented in derived classes. Allows to disable clicks, without showing the button as disabled. Handler for any [which?] change in properties of the control. Links an button to an action. The button to which this action applies. Installs the client button. TBasicActionLink.AssignClient Sets the Checked property of the linked button. TActionLink.SetChecked class of TButtonActionLink The base class for clickable buttons (TButton and TBitBtn). Notifies Parent of focus changes. Propagates ModalResult to the parent form, before further processing. TControl.Click Notify the widget of dynamic changes of the Default property. Notify the widgetset of changes in the Caption and/or accelerator. Update the parent form's Default and Cancel properties. Invoke Click if the control is Active or Default. TControl.ExecuteDefaultAction Invoke Click if the control is the Cancel button. TControl.ExecuteCancelAction True if this control is the Cancel or Default button. True if this is the modal Cancel button.

Pressing ESC in a modal form is equivalent to pressing the Cancel button.

True if this is the modal Default button.

Pressing ENTER in a modal form is equivalent to pressing the Default button.

When clicked, the button will close the form and return its ModalResult. (unless mrNone) A push button control. The states of a checkbox - Unchecked, Checked or Greyed. The check box has no check mark, indicating that the item is not selected. The check box has a check mark in it, indicating that the item is selected. The check box state cannot be changed by the user. The base class for checkbox components.

Check boxes present the user with options that can be selected (checked) or deselected (unchecked).

Invokes either the OnClick or OnChange handler. Overridden to do nothing. Invokes either the OnClick or OnChange handler. Retrieves the checkbox state from the widget. Alternate between checked and unchecked state. [What about disabled state?] Asks the widget to update the visual appearance of the object. Allows the check box to be in a "grayed" state.

If AllowGrayed is set to True, the check box has three possible states: checked, unchecked and grayed. If AllowGrayed is set to False, the check box has only two possible states: checked and unchecked.

Indicates whether the check box is checked (selected), unchecked (deselected) or grayed (disabled).

See TCheckBoxState for possible values of State.

A label with a box which can contain a check mark. A labelled box capable of being checked or unchecked[???]

The Application Programmer is responsible for ensuring that the OnClick event handler recognises the State of the box, takes the appropriate Action and places the State into the next appropriate value

A selection button that works with other Radio Buttons in a mutually exclusive way - if one button is selected, none of the others in the group can be selected.

The Application Programmer is responsible for ensuring that the OnClick event handler for each button has a unique Action, and that the Actions of the other (deselected and therefore inactive) buttons are turned off.

TRadioGroup behaves differently from a group of TRadioButton controls placed arbitrarily around a form.

In the case of TRadioButton, the mutual exclusivity is a feature that applies to any RadioButton anywhere in the Form, and the RadioButtons can be rearranged in any order or placed anywhere within the containing Form, while in TRadioGroup the exclusivity applies only to buttons within the Group, which are ordered strictly according to their ItemIndex within the Items stringlist.

TRadioButton is an entity in itself, with a number of additional properties, whereas the buttons within TRadioGroup are not separate entities, but rather are simply entries in a list of strings, each of which is associated with the on-screen image of a RadioButton.

The example shows the difference between the use of TRadioButton and TRadioGroup

TRadioGroup
The base class for TLabel. Always False, as you can't tab to a label. TControl.CanTab Determines the origin of the text, within the control. Searches for newline characters in the text. Determines the text extent, base on a maximum field width. Where wordwrap may start. Defers the focus to the FocusControl. Returns the Caption string. Handles OptimalFill. Calculate the maximum height of the font needed to fit the available space, given the MaxWidth and MaxHeight constraints If True, attempts to adjust font for an optimal fill of the space available. Horizontal text justification (centered, left- or right-justified). The control associated with the label and its accelerator key (AccelChar).

Set FocusControl to the control that shall receive the focus, when the label's accelerator key is pressed.

A label control cannot receive the focus (it's read-only), but can display an accelerator key indicator, just as menu entries can do.
A windowed control (Edit...) can receive focus, but cannot indicate an accelerator key.

Using a combination of both an label and another control allows to specify both the accelerator key, in the label's caption, and make the other control receive the focus when the user presses that accelerator key.

An accelerator key is marked by an ampersand '&' in the label's caption, immediately preceding the character to be used as the accelerator key. The marked character appears underlined on screen, when ShowAccelChar=True.

E.g. when you have a NameEdit1 control on a form, preceded by a label NameLabel1, you can set NameLabel1.FocusControl to NameEdit1, and NameLabel1.Caption to '&Name'. This makes the NameLabel1 displayed as 'Name'.

Vertical alignment of the text (at top, bottom or centered). If True, the font size is adjusted for optimal fill of the available space. Underlines the character in the label that acts as an accelerator with a shortcut key.

When False, ampersands '&' in the label's caption are displayed as ordinary characters (as in the Object Inspector).

When True, the character following the ampersand appears underlined, and when the user presses the accelerator key (CTRL+character), the text cursor jumps to the associated FocusControl.

Whether the viewer can see through the control. Default True [Delphi: False?]

Opaque Labels have their enclosing rectangle filled with the background color of the label. This can be the color of the Parent control, when ParentColor is True.

Setting Transparent to True makes the label transparent, not hiding any background details.

When a label is put onto a graphics control, setting Transparent to False makes the label stand out, while Transparent=True doesn't obscure so much of the graphic.

Allows text to wrap into multiple lines, when the text is too long for the available Width.

When False, the text is truncated at the right margin of the control.

WordWrap=true and AutoSize=true requires that the Width is fixed, e.g. by anchoring the left and right side.

Control to show static text, possibly in multiple lines. Registers the components declared in this unit. How to use StdCtrls, ComCtrls or ExtCtrls

The Units StdCtrls, ComCtrls and ExtCtrls contain definitions and descriptions of many of the most commonly used controls for constructing Forms and other objects in Lazarus GUI applications.

Most controls are split into a final class, such as TButton, TMemo, TScrollBar etc., and a corresponding ancestor class such as TCustomButton, TCustomMemo or TCustomScrollBar. The final class is designed for immediate use, it almost only publishes the properties of the control. The corresponding custom ancestor class (TCustomXXX) can be used to derive controls with special (customized) appearance or behaviour.

If you drop a component from the component palette on the form editor you don't need to add code explicitly to create it. The component is automatically created by the IDE together with the form, and destroyed when the form is destroyed.

However, if you create the component yourself by code, and don't specify an Owner for it (Create(Nil)), you are responsible for freeing the component when it is no longer needed. You better construct it with Create(Self), where Self means the containing Form or Parent control.

A control also must have a Parent control, maybe the Form, so that it can become visible within the client area of its Parent. The Top and Left properties specify the placement of the control within its Parent. The Object Tree reflects the Parent-Client relationships of all controls on the form.

Unlike controls, mere components are invisible at runtime (Open Dialogs...). Controls can be made invisible at runtime as well, by setting their Visible property to False.

If you place a component on the Form Designer and look at the Object Inspector, you can observe the Top and Left properties change as you move the component around. The same for the Width and Height properties, when you resize a control by dragging it's size grips.

When you modify the properties in the Object Inspector, the control on the form will reflect the changes as well.

You can also explicitly change the properties of the object in code by typing (in the appropriate Implementation section of the Source editor), for example

Form1.Button1.Height := 48;

In summary, there are usually about three different ways to determine each property of a component:

  • by using the mouse,
  • by setting the values in the Object Inspector,
  • or explicitly by writing code.

The components defined in these Units have several properties that are common to most of them, and other properties that are specific to the individual components. We shall describe the most common ones here. Unusual or control-specific properties will be described for the individual controls.

Additional Help can always be obtained by selecting a property or keyword, in either the Object Inspector or the Source Editor, and pressing F1. You will be taken by your Help browser to the appropriate page in the documentation.

If the description of a property on that page is insufficient, you can navigate to the corresponding description in the ancestor classes, by selecting the links in the Inheritance listing or by selecting the ancestor Type in the declaration of the object.

Some commonly listed properties
Property Meaning
Action Use Action when e.g. a button and a menu entry shall perform the same task, e.g. the Close action.
Align Defines how a control is lined up within its parent control. Possible values are alTop, alBottom (stacked at the top or bottom, using the full available width), alLeft, alRight (placed at the left or right, using the full available height), alNone (place anywhere on parent control) or alClient (takes all available space left over by other controls).
Anchor Used to keep a control at a fixed distance from the edges of its Parent control, when the Parent is resized. For example [akBottom, akRight] will keep the control a fixed distance from the bottom right corner. Anchoring both [akLeft, akRight] will make the control extend or shrink in Width, together with its Parent.
AutoSelect When True, a text control will select all its text when it receives focus or when the Enter key is pressed.
AutoSelected True indicate that the edit or combobox control has performed an AutoSelect operation, so that subsequent mouse-clicks and keystrokes proceed normally without selecting the text.[~remove this?]
BorderSpacing The space around the edge between an [Anchored???] control and its siblings [parent?].
Caption The text that is displayed on the control; it should preferably give some clue as to the function of the control, or an instruction such as 'Close' or 'Execute'. By default Caption is set to be the same as the 'Name' property, and the application designer should substitute meaningful text instead of the default values.
CharCase Indicates how text is displayed in a text editing control: Normal (retaining the case of the letters typed by the user), converted to uppercase, or converted to lowercase
Constraints Sets the minimum and maximum sizes for a control. If a control is resized the new dimensions are always within the ranges given here. You should take care when setting these options that they do not conflict with the Anchors and Align settings.
Color The Color to be used to draw the control's background [or to write the text it contains -> Font.Color!???].
Enabled Determines whether a control can be selected or perform an action. If it is not Enabled, it is often Grayed out on the Form.
Font The Font to be used for writing the text associated with the control - either the caption or label, or the text-strings contained within the control. The entry on the Object Inspector usually has a (+) box on the left, and selecting this box reveals further options such as character set, color and size.
Hint A short informative pop-up text that appears when the mouse-cursor moves over the control.
Items The list of 'Things' that the object contains, such as a group of images, a series of lines of text, a number of actions in an actionlist, etc
Lines An array of strings, containing the paragraph texts in Memo controls. The array index is zero-based, ie the lines are numbered [0..numLines-1]
Name The identifier by which the control is known in the program. The IDE gives it a default name based on the underlying type, for example successive instances of TBitButton would be named Form1.BitBitton1 and Form1.BitButton2; it is up to the application programmer to give them more meaningful names such as ExitButton or OKButton. By default the Name of the control is applied to the Caption for the control, but the text of the Caption may be changed separately.
PopUpMenu A window containing context-sensitive menu entries, that pops up when the right mouse button is clicked on the object.
Position (or Top, Left) Determines where the control is located on the parent form or control.
ReadOnly If True, the user cannot change the text in the control.
ShowHint Allows to enable or suppress Hints.
Size (or Height and Width) The dimensions of the control
Style The options available for Style depend upon the sort of Control being considered: for instance the Style may be defined by TFormStyle, TBorderStyle, TButtonStyle etc.
TabOrder Specifies the sequence of controls, that are entered when the user presses the Tab key.
TabStop Specifies whether the control can be reached (or is skipped) by pressing the Tab key.
Text Like Caption, the user editable text that appears in the control. Applies particularly to Edit, Memo and ComboBox types of controls. Most of the editing operations (such as Select, Clear, Cut, Copy) are performed in this property. If the control contains more than a single line of text, then the textual elements are arranged as a zero-based array of strings in Lines (TMemo) or Items (TListBox, TComboBox).
Visible If true, the control can be seen on the Form; if False, it is hidden.
WordWrap Allows to wrap the Text into multiple lines. When False, the text is clipped at the right margin of the control, but it still can be inspected by moving the caret within the text.

The 'Events' tab in the Object Inspector contains a list with events, which can occur for this control. If you select an entry in the list, a ComboBox appears with a DropDown list showing any event handlers that have aleady been defined, and allowing you to choose one for this event. Alternatively you can select the ellipsis (three dots ...) and you will be taken to the Source Editor, where the Object Inspector created an new event handler method for you. You also can type the name of your handler in the Object Inspector and press Enter, to create a new handler method.

While a large number of events is available for any given control, in practice it is only necessary to populate a few of them. For most controls, it is sufficient to provide coding for 'OnClick'; for more complex controls it may be necessary also to provide for 'OnEntry' (when the control receives the focus) and 'OnExit' (when the control looses the focus); or you may need to write an event handler for 'OnChange' or 'OnScroll', depending on the nature of the particular control with which you are dealing.

Many controls have a default event, usually OnClick, for which an handler is created with a double click on the control. Or right click on the control, and select the first entry: 'Create default event'.

A common strategy in Object-Oriented programming is to provide an ActionList with the facility for entering, removing or editing a number of pre-defined actions, from which the most appropriate can be selected to use in any particular instance [of?].

Some commonly listed Actions[???]
Event Meaning
OnChange Action to be taken if any change is detected (e.g. by mouse click, key press, edit text, etc)
OnClick Action to be taken when the (left) mouse button is clicked. This is usually the main or default action of the control; for example clicking on a button or checkbox initiates the action associated with the checkbox. It may alternatively initate a process of selection, for instance in a TextBox or Memo.
Click[here???] A method to emulate in code the effect of clicking on a control. This method is most often found in Button-type controls (TButton, TBitBtn, TSpeedButton etc). A procedure can be written that calls the same code as the OnClick action. This facility can be particularly useful if the activation of one control by clicking causes a cascade of other controls to be activated, and the Click method can be used to initiate the action rather than having the user explicitly click on a lot of controls.
OnDragDrop Action to be taken when a dragged control has been dropped onto this control. [OnDragOver?]
OnEntry Action to be taken when the control receives the focus. This might include changes in the appearance of the object such as highlighting or raising the border.
OnExit Action to be taken when control is about to loose the focus. This is the right place for validity checks of user input, with a chance to disallow moving to a different control when the input is invalid.
OnKeyPress Action to be taken on an entered character. Checks...
OnKeyDown Action to be taken if a key is down while focus is in this control. This allows to filter or process control characters in a special way.
OnKeyUp Action to be taken if a key goes up. This event occurs only once, while auto-repeated keystrokes trigger multiple OnKeyDown or OnKeyPress events.
OnMouseMove Action to be taken if the mouse cursor moves over the control. This event fires with every small move, while OnMouseEnter and OnMouseLeave occur only when the mouse enters or leaves the control.
OnMouseDown Action to be taken when a mouse button is pressed over the control.
OnMouseUp Action to be taken if a mouse button goes up over the control.
OnResize Action to be taken when the control is resized. Might include re-alignment of text or selection of a different font size etc. Do not mix up with AutoSize, or you ask for trouble!

Constructors such as Create allocate memory and system resources needed by the object. They also call the constructor of any sub-objects present in the class.

Destructors: remove the object and de-allocate memory and other resources. If you call Destroy for an object which hasn't being initialized yet it will generate an error. Always use the Free method to deallocate objects, because it checks whether an object's value is nil before invoking Destroy.

Take the following precautions when creating your own Destroy method:

  • Declare Destroy with the override directive, because it is a virtual method.
  • Always call 'inherited Destroy;' as the last thing on the destructor code.
  • Be aware that an exception may be raised on the constructor in case there is not enough memory to create an object, or something else goes wrong. If the exception is not handled inside the constructor, the object will destroyed immediately. In this case Destroy will be called with a partially initialized object, so your destructor must check if the resources were really allocated before disposing of them.
  • Remember to call Free for all objects created on the constructor.