Data-Aware controls commonly used for viewing and operating on information held in databases TFieldDataLink - forms a link between a database field and an action ActiveChanged - method to process changes in the Active property

ActiveChanged - method to process changes in the Active property

Any change to the Active property triggers the ActiveChanged method.

If the method is triggered by a transition into an Active state, then ActiveChanged ensures that this TFieldDataLink's Field is still valid before calling the event handler.

ActiveChanged calls an OnActiveChange event handler if one has been assigned.

DataSetChanged - method to process a change in the DataSet EditingChanged - method for processing changes in the Editing property LayoutChanged- called if layout is changed: tests validity of field then calls OnLayoutChange event handler RecordChanged - triggered if the contents of the current record change; calls Reset UpdateData - if there are any pending changes, calls OnUpdateData event handler FocusControl - gives this control the input focus; calls the OnFocusRequest event handler Create - calls inherited Create then initialises field information TObject.Create TDataLink.Create Edit - if the field can be modified, performs inherited Edit and shows editing status TDataLink.Edit Modified sets the IsModified local variable to True Reset - checks that link is active, calls the OnDataChange event handler then sets IsModified to False The Control to which this datalink is attached The Field to which the datalink is attached FieldName - the name of the attached field, stored as a string CanModify - True if the linked field is capable of being modified Editing - True if the linked field is being edited OnDataChange - event handler for a change in the data OnEditingChange - event handler for a changed in the Editing property OnUpdateData - event handler for updating any pending changes in the data OnActiveChange - event handler for a change in the Active property OnFocusRequest - event handler for a request to give focus TDBEdit - a data-aware edit box for processing a single text-string from a dataset Create - Constructor for TDBEdit: calls inherited Create then sets up data links and actions TCustomEdit.Create Destroy - destructor for TDBEdit: frees data links then calls inherited Destroy TWinControl.Destroy The field in the DataSet from which data are to be displayed in the Edit Refers to the complete Field entity, not just its name The name (as a string) of the field whose data are to be displayed The DataSource to be used for supplying the data in the required Field. Ususally the result of a data query

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent control

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

// standard properties, which should be supported by all descendants

AutoSize permits the size of a control to be adjusted automatically, for example a button can become bigger or smaller to accommodate a longer or shorter caption.

Reads logical (boolean) flag to see whether auto-sizing is to be operated, or writes the flag to say it should be done. Default is false, ie no auto-sizing

Indicates how text is displayed in a text editing control in the following ways:

  • Normal case letters
  • Upper case letters
  • Lower case letters

The rules can, of course, be overridden by use of the shift key.

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

// standard properties, which should be supported by all descendants

Determine Constraints (max and min height and width) for this control; reads the size constraints or stores new ones.

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

// standard properties, which should be supported by all descendants

Reads a flag to see what font should be used, or sets a flag to store it. If stored, sets a flag to say so

The properties of Font are defined in the parent class TFont

PasswordChar : the character which appears in the Edit box replacing and masking the actual character typed.

Typically used in password input, to prevent the typed characters from being seen by passers-by or casual observers (or even malicious observers!)

// standard properties, which should be supported by all descendants
Reads the details of the pop-up menu, or stores them.
Properties are defined in the parent class TPopupMenu
// standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1

Reads or writes boolean flag; default is False

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't use the Tab key to move to the control.

The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

TDBText - a data-aware text component to display a single text-string from a dataset

Loaded is called by the streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved by the streaming system. Descendents of TComponent should override this method to do some additional processing of properties after all published properties have been set from values obtained from the stream.

Application programmers should never call Loaded directly, this is done automatically by the streaming system.

Notification is called whenever a child component is destroyed, inserted or removed from the list of owned component. Components that were requested to send a notification when they are freed ((with FreeNotification) will also call Notification when they are freed.

The AComponent parameter specifies which component sends the notification, and Operation specifies whether the component is being inserted into or removed from the child component list, or whether it is being destroyed.

Descendents of TComponent can use FreeNotification to request notification of the destruction of another object. By overriding the Notification method, they can do special processing (typically, set a reference to this component to Nil) when this component is destroyed. The Notification method is called quite often in the streaming process, so speed should be a consideration when overriding this method.

Create - constructor for TDBText: calls inherited Create then forms data links and actions TCustomLabel.Create Destroy - destructor for TDBText: frees data links then calls inherited Destroy TGraphicControl.Destroy The field in the DataSet to which this control is to be linked. Can be referred to by name, or as an index

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

// standard properties, which should be supported by all descendants

AutoSize permits the size of a control to be adjusted automatically, for example a button can become bigger or smaller to accommodate a longer or shorter caption.

Reads logical (boolean) flag to see whether auto-sizing is to be operated, or writes the flag to say it should be done. Default is false, ie no auto-sizing

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecesary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

The name of the field, as a string (ie cannot be referred to as an Index) The DataSource from which information is obtained to display in this control. Usually the result of a SQLQuery

// standard properties, which should be supported by all descendants

Reads a flag to see what font should be used, or sets a flag to store it. If stored, sets a flag to say so

The properties of Font are defined in the parent class TFont

ShowAccelChar - underline the character in the label that acts as an accelerator with a shortcut key

Boolean property - default True

The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.

WordWrap - whether a word is to be wrapped to the next line if the text is about to become too long for the width available

Boolean property, default False

TDBListBox - a data-aware version of TListBox, for displaying lists of entries from a field in a database

Loaded is called by the streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved by the streaming system. Descendents of TComponent should override this method to do some additional processing of properties after all published properties have been set from values obtained from the stream.

Application programmers should never call Loaded directly, this is done automatically by the streaming system.

Notification is called whenever a child component is destroyed, inserted or removed from the list of owned component. Components that were requested to send a notification when they are freed ((with FreeNotification) will also call Notification when they are freed.

The AComponent parameter specifies which component sends the notification, and Operation specifies whether the component is being inserted into or removed from the child component list, or whether it is being destroyed.

Descendents of TComponent can use FreeNotification to request notification of the destruction of another object. By overriding the Notification method, they can do special processing (typically, set a reference to this component to Nil) when this component is destroyed. The Notification method is called quite often in the streaming process, so speed should be a consideration when overriding this method.

Click - a procedure that allows the programmer to simulate a mouse click over the control, and initiates the same Action as that associated with the OnClick event EditingDone - what to do when you have finished editing

TControl.EditingDone

Called when user has finished editing. This procedure can be used by data links to commit the changes.

For example:

  • When focus switches to another control (default)
  • When user selected another item

It's totally up to the control, what events will commit.

Create - constructor for TDBListBox: calls inherited Create then forms data links and actions Destroy - destructor for TDBListBox: frees data link then calls inherited Destroy The Field of the DataSet for which data are to be displayed Regers to the whole Field entity, not just its name

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

OnDrawItem - event handler for drawing an Item

For example, selecting an item may require it to be highlighted or have its font or background changed

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

// standard properties, which should be supported by all descendants
Reads or Writes flag if control is re-sized.
// standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1

Reads or writes boolean flag; default is False

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't use the Tab key to move to the control.

The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
TDBRadioGroup - a data-aware version of TRadioGroup, providing a series of mutually exclusive buttons to select an entry to insert into a database field

The properties of TDBRadioGroup are similar to those of TRadioGroup (and TCustomRadioGroup). Access is obtained to members of the group by selecting (in the Object Inspector) the ellipsis (...) next to the entry Items, and then editing the stringlist.

At runtime, selecting one of the radiobuttons makes the corresponding ItemIndex available to the programmer, and the corresponding string Item gets selected and appears as the string value for the record in that field.

Change - calls the OnChange event handler if it is assigned DataChange - updates the current Value to reflect a change inthe data UpdateData - places the current Value into the data DataLink - the field data link to be used for the data GetButtonValue - returns the string value of the button associated with the specified index UpdateRadioButtonStates - performs the inheited method and ensures that any updates are also reflected via the data link, if it is active and in an Editing state TCustomRadioGroup.UpdateRadioButtonStates EditingDone - updates the record through the datalink, then calls inherited EditingDone TControl.EditingDone Create - constructor for TDBRadioGroup: calls inherited Create then forms datalinks and actions TCustomRadioGroup.Create Destroy - destructor for TDBRadioGroup: frees links and items, then calls inherited Destroy TCustomRadioGroup.Destroy The DataSet Field relevant to the data being selected Refers to the complete Field entity, not just its name The selected value (as indicated by ItemIndex)

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecesary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

Don't confuse this with the Columns entity in a DBGrid, nor with the COLUMNS entity in a SQL database - it simply refers to the number of columns of radiobuttons to be displayed

The name (as a string) of the Field whose data are linked to the control The DataSource from which relevant Field data are to be linked - usually the result of a database query

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

Event Handler for any change in the radiogroup selection

// standard properties, which should be supported by all descendants

Reads or Writes flag if bounds are changed

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

// standard properties, which should be supported by all descendants
Reads or Writes flag if control is re-sized.
ReadOnly - if True, data can only be read, not written or modified. (Doesn't really make sense for a RadioGroup!) The values of the strings in Items
The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
TDBCheckBox - a data-aware checkbox for use with logical fields in a database GetFieldCheckState - returns the checkbox state for the current field DataChange - uses GetFieldCheckState to update the State UpdateData - examines the State to see whether it has changed FocusRequest - a request has been received, so Sets Focus EditingDone - if the datalink is in an Editing state, updates the data through the link then calls inherited EditingDone TControl.EditingDone Create - constructor for TDBCheckBox: calls inherited Create, forms logical connections for checked and unchecked, sets initial style and state, forms datalinks and actions TCustomCheckBox.Create Destroy - destructor for TDBCheckBox: frees links and calls inherited Destroy TWinControl.Destroy The Field in the DataSet with which the box is to be associated

Refers to the whole Field entity, not just its name

See TCheckBoxState for possible values of 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.

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

// standard properties, which should be supported by all descendants

AutoSize permits the size of a control to be adjusted automatically, for example a button can become bigger or smaller to accommodate a longer or shorter caption.

Reads logical (boolean) flag to see whether auto-sizing is to be operated, or writes the flag to say it should be done. Default is false, ie no auto-sizing

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecesary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

The name (as a string) of the field with which the checkbox is to be associated The DataSource containing the Field that is to be associated with this checkbox

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

Hint - a small informative pop-up box that appears when the mouse 'hovers' over a control

Requires ShowHint to be True

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

// standard properties, which should be supported by all descendants
Reads the details of the pop-up menu, or stores them.
Properties are defined in the parent class TPopupMenu
ReadOnly - if True, data may be read but not written or modified (doesn't make much sense for a check-box unless the box is NOT Enabled!) // standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1 Use the TabStop to allow or disallow access to the control using the Tab key. If the TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't press the Tab key to move to the control. ValueChecked - the box for the value has been checked ValueUnchecked -the box for the value is unchecked
The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
TDBComboBox - a data-aware version of TComboBox to allow selection of a value from a list of entries into a database field

TDBComboBox has properties similar to TComboBox and TCustomComboBox. It consists of an Edit Box which is th eData-aware part of the component, and a drop-down list box.

In a typical application a user would be presented with the drop-down list, would make a selection and then this would appear in the edit box and become the data value for that cell in the database.

So for example a list of countries might be presented, and the selected value from the list would be used to populate the appropriate field ('Country') in that record of the database.

DataChange - updates the text if it has changed EditingChange - (currently no action) UpdateData - copies the new data via the datalink TCustomDBComboBox.UpdateData FocusRequest - a request has been received and Focus is set Create - constructor for TDBComboBox: calls inherited Create then sets default style and forms datalinks and actions Destroy - destructor for TDBComboBox: frees datalinks then calls inherited Destroy The field in the dataset to which this control is attached Text - the string appearing in the main box. If an item on the drop-down list is selected, it replaces the contents of Text Index - the number of the currently selected item (starting at zero)

Index - the number of the currently selected item

The first item has number 0, the second has number 1, the third number 2, etc.

In case no item is selected, ItemIndex has value -1.

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

AutoDropDown - if True, the drop-down list appears as soon as the cursor moves over the text box

If False, the drop-down box only appears when the downward triangular indicator at the end of the box is selected

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

The Font to be used for text in this control

// standard properties, which should be supported by all descendants

Reads a flag to see what font should be used, or sets a flag to store it. If stored, sets a flag to say so

The properties of Font are defined in the parent class TFont

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

// standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1

Reads or writes boolean flag; default is False

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't use the Tab key to move to the control.

The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
TDBMemo - a data-aware Memo box to process the multi-line text of a single field in a dataset DataChange - if Data changed, loads the new data into the appropriate part of the Field UpdateData - if data changed, copy new text via the datalink FocusRequest - a request has been received, so focus is given EditingDone - if link allows modifications and is in an Editing state, updates data via the link then calls inherited EditingDone TControl.EditingDone Create - constructor for TDBMemo: calls inherited Create, then sets style and forms datalinks and actions TCustomMemo.Create Destroy - destructor for TDBMemo: frees datalinks then calls inherited Destroy TCustomMemo.Destroy LoadMemo - tries to load data from current field as a string if possible, otherwise returns an exception The field in the DataSet to which this control is to be linked. Can be referred to by name, or as an index AutoDisplay - if True, automatically displays the data when loaded The name of the field, as a string (ie cannot be referred to as an Index) The DataSource from which information is obtained to display in this control. Usually the result of a database query TDBGroupBox - a data-aware version of TGroupBox, allowing a number of data-aware objects to be grouped together on a form FDataLink - local variable storing the identity of the Field Data Link GetDataField - returns the name of the data field GetDataSource - returns the identity of the data source GetField - returns the identity of the field to which the group box is atttached SetDataField - specifies the data field to which the group box is attached SetDataSource - specifies the data source to be used by the group box DataChange - if Data changed, loads the new data into the caption

Loaded is called by the streaming system when a root component was completely read from a stream and all properties and references to other objects have been resolved by the streaming system. Descendents of TComponent should override this method to do some additional processing of properties after all published properties have been set from values obtained from the stream.

Application programmers should never call Loaded directly, this is done automatically by the streaming system.

Notification is called whenever a child component is destroyed, inserted or removed from the list of owned component. Components that were requested to send a notification when they are freed ((with FreeNotification) will also call Notification when they are freed.

The AComponent parameter specifies which component sends the notification, and Operation specifies whether the component is being inserted into or removed from the child component list, or whether it is being destroyed.

Descendents of TComponent can use FreeNotification to request notification of the destruction of another object. By overriding the Notification method, they can do special processing (typically, set a reference to this component to Nil) when this component is destroyed. The Notification method is called quite often in the streaming process, so speed should be a consideration when overriding this method.

Create - constructor for TDBGroupBox: calls inherited Create then sets up datalinks and actions TCustomGroupBox.Create Destroy - destructor for TDBGroupBox: frees datalinks then calls inherited Destroy TWinControl.Destroy The field in the DataSet to which this control is to be linked. Can be referred to by name, or as an index

// standard properties, which should be supported by all descendants

Either reads a flag containing alignment instructions (FAlign) or writes alignment instructions (SetAlign)

May have no alignment, may have custom or client alignment, or can be aligned to top, bottom, left or right

// standard properties, which should be supported by all descendants

Determines how the control is to be anchored to its client or parent conrol

Either reads a flag containing the set of anchors to be used, or writes a set of anchors. If they have been written, this is indicated in IsAnchorsStored

Gets caption as a text-string (GetText), or stores the new caption (SetText). Shows flag if caption is stored (IsCaptionStored).

By default, the Caption appears the same as the control Name in the Object Inspector, and the developer needs to set it explicitly to some new text.

The VCL implementation relies on the virtual Get/SetTextBuf to exchange text between widgets and VCL. This means a lot of (unnecesary) text copies.

The LCL uses strings for exchanging text (more efficient). To maintain VCL compatibility, the virtual RealGet/SetText is introduced. These functions interface with the LCLInterface.

The default Get/SetTextBuf implementation calls the RealGet/SetText. As long as the Get/SetTextBuf isn't overridden Get/SetText calls RealGet/SetText to avoid PChar copying.

To keep things optimal, LCL implementations should always override RealGet/SetText. Get/SetTextBuf is only kept for compatibility.

// standard properties, which should be supported by all descendants

Finds or sets the client height, and sets a flag if it has been stored

ClientWidth - determines the width of the client within which the control exists

// standard properties, which should be supported by all descendants

ClientWidth - determines the width of the client within which the control exists; reads the width of the client control or sets the value. Sets flag if value is stored

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

// standard properties, which should be supported by all descendants

Determine Constraints (max and min height and width) for this control; reads the size constraints or stores new ones.

The name of the field, as a string (ie cannot be referred to as an Index) The DataSource from which information is obtained to display in this control. Usually the result of a SQLQuery

// standard properties, which should be supported by all descendants

Whether the control is Enabled. If not, it usually appears 'greyed-out'

Reads a flag to see whether the control is enabled, or stores a new value. If stored, sets a flag to say so.

// standard properties, which should be supported by all descendants

Reads a flag to see what font should be used, or sets a flag to store it. If stored, sets a flag to say so

The properties of Font are defined in the parent class TFont

// standard properties, which should be supported by all descendants

This is often the default action for many controls, and is often the ONLY action specified by the programmer. The action can be spcified by the user, either by typing explicit code into the implementation section for this control, or by selecting an action from a pre-supplied ActionList

Reads or writes a flag if a mouse click is detected, and sets a flag if a value is stored.

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

OnKeyDown - event handler for instance when key is down while control has focus

Differs from OnKeyPress in that the key may have already been down when the control received focus; with OnKeyPress the key needs to become pressed while the control has focus.

OnKeyPress - event controller for a key being pressed while the control has focus

Differs from OnKeyDown in that the key needs to become pressed while the control has focus; with OnKeyDown the key may have already been down when the control received focus.

OnKeyUp - event handler for instance when a key is up (not pressed) while the control has focus

The key may already have been up when the control received focus, or a pressed key may become released during the time the control has focus.

// standard properties, which should be supported by all descendants
Reads or Writes flag if control is re-sized.
// standard properties, which should be supported by all descendants
Reads the details of the pop-up menu, or stores them.
Properties are defined in the parent class TPopupMenu
// standard properties, which should be supported by all descendants
Reads flag or writes one to determine if a hint is to be shown when mouse hovers over this control. If value is stored, a storage flag is set. Display of the actual hint is controlled by OnShowHint
Reads or writes information in flag; default is -1

Reads or writes boolean flag; default is False

Use the TabStop to allow or disallow access to the control using the Tab key.

If TabStop is True, the control is in the tab order. If TabStop is False, the control is not in the tab order and the user can't use the Tab key to move to the control.

The Visible property represents the ability to see a visual control. 
          If Visible is True the control is shown, otherwise it is hidden.
          Calling Show sets, among others, Visible to True.
          Setting Visible to False is equivalent to calling Hide method.
The Visible property does not depend on control's parent visibility. Use IsVisible method to consider this and get real visibility.
TDBImage - a data-aware Image box to display a single image from a dataset The Image is stored in the database as a Binary Large Object (BLOB) DataChange - if data changed, load new picture UpdateData - if data changed, save new picture LoadPicture - loads picture into the appropriate field for the graphic class of the caller Create - constructor for TDBImage: cals inherited Create then sets style and display methods, forms datalinks and actions TCustomImage.Create Destroy - destructor for TDBImage: frees datalinks and calls inherited Destroy TCustomImage.Destroy The Field in which picture data are stored AutoDisplay - if True, automatically displays when focus is given The name of the DataField that holds the image The identity of the DataSource that holds the image The picture that is to be stored or displayed True if image is proportional QuickDraw - if True, quick drawing is implemented ReadOnly if True, image can be inspected byt not modified or written TDBCalendar - a data-aware version of TCalendar, for selecting a date to put in a database field A pop-up calendar appears, and the user can navigate through years, months and days to select the date that is required. When a date is selected, it is inserted into the Date field of the appropriate record in the database. FDataLink - local variable to hold identity of the field data link DataChange - if the link is active, transmit the changed data UpdateData copy changed data into the text fileld FocusRequest - a request has been received to give focus, so it is given GetDataField - returns the name of the Data Field GetDataSource - returns the identity of the data source GetField - returns the identity of the data field GetReadOnly - returns the ReadOnly state SetReadOnly - specifies the value for ReadOnly SetDate - specifies the date as a string SetDataField - specifies the data field to use for the calendar SetDataSource - specifies the data source to which the calendar is linked EditingDone - changes data over the link then calls inherited EditingDone TControl.EditingDone Create - constructor for TDBCalendar: calls inherited Create and forms datalinks and actions TCustomCalendar.Create Destroy - destructor for TDBCalendar: frees datalinks and calls inherited Destroy TWinControl.Destroy The Field to which the calendar is attached The name of the DataField as a string The identity of the DataSource holding the date information The Date obtained from the Calendar TDBNavButtonType TDBCustomNavigator - the base class for TDBNavigator, a tool for navigating through the records of a dataset

TDBCustomNavigator is the parent class for TDBNavigator, an advanced tool for navigating through datasets held locally in response to a query sent to the database. Most of the important properties are defined here.

It consists of a series of toolbuttons to move to the First, Prior, Next or Last record; to Insert or Delete a record; to Edit a record (enter Edit mode), to Post the changes. to Cancel the changes, and to Refresh the display from the database. The set of buttons for display can be customised in VisibleButtons, which allows display of individual buttons to be suppressed

If used in conjunction with a DataAware control such as TDBGrid or TDBMemo it controls which records are displayed , the position of the record selection cursor, and the initiation of changes to the dataset and ultimately the database.

Most of the functionality of the toolbar is already built-in to the control, but if the programmer needs to specify actions to be associated with individual buttons, there is a procedure BtnClick to which an argument can be sent with the index value of the button clicked, and the procedure chooses which action to call dependent on the button index.

The DataSource property must be set to link to the appropriate set of data.

The list of Buttons included in the navigator tool DataChanged - update status of all the buttons to reflect new data EditingChanged - the status of the buttons is set to CanModify ActiveChanged - if datalink is active, calls DataChanged and EditingChanged DataChanged EditingChanged UpdateButtons - if the position of the buttons need to be changed, does this, then updates the status of the buttons (see ActiveChanged) ActiveChanged UpdateHints - reloads the default hints and modifies any that have been changed HintsChanged - calls UpdateHints UpdateHints ButtonClickHandler - performs BtnClick for the appropriate button DoOnResize - calls UpdateButtons UpdateButtons BeginUpdateButtons - locks the buttons before updating them EndUpdateButtons - unlocks each button in turn and updates it if needed Create - constructor for TDBCustomNavigator: locks the buttons, calls inherited Create, sets default size, style, forms datalinks, initialises hints, updates the buttons TCustomPanel.Create Destroy - destructor for TDBCustomNavigator: frees datalinks and hints, then calls inherited Destroy TCustomControl.Destroy BtnClick - procedure to respond to button clicks, and select an action from a list according to the value of the Index of the clicked button Finds the number of visible buttons BeforeAction - code to be executed before an action is performed Should the user be asked for confirmation before a record is deleted? If True, a dialog appears asking for confirmation The Data Source to which the control must be linked in order to function The direction in which the buttons appear: horizontal or vertical Flat - if True, buttons have no 3-D effect A list of hints to be shown if the mouse hovers over a button The action to be taken when a navigator button is clicked TControl.OnClick The set of visible buttons (some of them can be suppressed if their function appears redundant)

The VisibleButtons entry in the Object Inspector can be used to set whether or not a particular button is to be visible.

Determines whether button hints are to be shown TDBNavButton - one of the SpeedButtons on a TDBNavigator tool NavStyle - the style of Navigator Button Index - the value from the enumerated type that specifies which button is being selected

Button may be

nbFirst, nbPrior, nbNext, nbLast, nbInsert, nbDelete, nbEdit, nbPost, nbCancel, nbRefresh

TDBNavDataLink - provides a link between a Database Navigator and a DataSet EditingChanged - method to process a change in the Editing property of the navigator DataSetChanged - method to process a change in the data set attached to the navigator ActiveChanged - method to process a change in the Active property of the navigator Create - constructor for TDBNavDataLink: calls inherited Create, attaches Navigator and sets VisualControl to True TObject.Create Destroy - destructor for TDBNavDataLink: frees Navigator and calls inherited Destroy TPersistent.Destroy TDBNavigator - a data-aware Button-Bar to facilitate navigating between records of a dataset

TDBNavigator is an advanced tool for navigating through datasets held locally in response to a query sent to the database.

It consists of a series of toolbuttons to move to the First, Prior, Next or Last record; to Insert or Delete a record; to Edit a record (enter Edit mode), to Post the changes. to Cancel the changes, and to Refresh the display from the database.

The programmer may determine, at design time, which buttons are to be displayed or suppressed by adjusting the VisibleButtons property in the Object Inspector.

If used in conjunction with a DataAware control such as TDBGrid or TDBMemo it controls which records are displayed , the position of the record selection cursor, and the initiation of changes to the dataset and ultimately the database.

Most of the functionality of the toolbar is already built-in to the control, but if the programmer needs to specify actions to be associated with individual buttons, there is a procedure TDBCustomNavigator.BtnClick to which an argument can be sent with the Index value of the button clicked, and the procedure chooses which action to call dependent on the button index.

The DataSource property must be set to link to the appropriate set of data.

HowToUseDataAwareControls - Hints for accessing databases

HowToUseDataAwareControls - Hints for accessing databases. A set of Data-Aware components is provided, to make it easier to access information held in databases.

Before using Data-Aware components, it is necessary to make a connection with a database, and this should be done either using a TSQLConnection or a TDBf component, depending on the type of database that is being used. In any case, the components for connection with the database need to be found in $Lazdir/components/sqldb/, $Lazdir/components/tdbf/ or whatever other source is appropriate. They need to be added using the Components Menu Item of the IDE, and compiled ready for adding. The IDE needs to be re-built to include the new components.

To make the connection with the database: first place a DataBase Connection on the Form (invisible at run-time, so put it anywhere convenient); set its properties to connect the user (with name and password) to the appropriate server, database and table (the connection component should deal with all the user-authentication issues, opening and closing the database etc). Then put on a TDataSource from the Data Access tab of the Component Palette, and perhaps items such as TSQLTransaction and TSQLQuery, depending on the particular database you are using. The various database components need to be linked to each other, for example by setting the Transaction property of a database connector to the appropriate transaction component, and linking the DataBase property of the Transaction component back to the database connector; link the DataSource's DataSet property to the appropriate SQLQuery or other set of data, and its Transaction property to the transaction component

Each Data-Aware control (on the Data Controls tab of the Component Palette) has the usual set of properties to determine its shape and size, position, colour and font etc. But there are also special properties to define the data to be displayed or modified. These include the DataSource property which must be set to link to the defined set of data, and often a Field component to determine which of the columns in the database is to be displayed.

Most of the components operate on a single Row or record of the database, but the TDBGrid is capable of displaying and operating on multiple rows and columns, in a StringGrid format, allowing the user to get an overview of what is in the database. The DBGrid will display the contents of the DataSet even at design time, provided the various components are enabled or rendered active; this allows the designer to ensure that all the connections to the database have been correctly made.

The TDBNavigator component is used in conjunction with the Data-Aware components. It consists of a series of buttons to allow browsing through the DataSet, displaying the first, previous, next or last record (or Row), inserting or deleting records, committing the changes back to the database or refreshing the DataSet from the database.

The way database programming works is typically as follows:

  • a database is opened for access by the user (Database Connection)
  • a command is issued (eg by TSQLQuery) to select or extract some or all of the records which are then stored locally in the DataSet
  • the contents of the DataSet are acted on by the Data-Aware components, displaying one Row or record at a time from selected Columns, or perhaps the whole DataSet in a DBGrid, editing records, inserting or deleting records, or using the data to perform statistical tests or calculations
  • at intervals usually prescribed by the user (sometimes after every change, sometimes after a whole series of changes), the contents of the local DataSet are sent back to the database, causing an update of the database's contents. This process is referred to as 'Commit' or 'Post' or sometimes as 'Update'

The programmer can determine which events are associated with a Commit action by supplying suitable event handlers for OnClick, OnChange, OnFinishedEdit etc.

The following table shows the approximate correspondence between conventional and data-aware control classes

Standard Control Data-Aware Control Comment
TCalendar TDBCalendar Select a date from pop-up calendar
TCheckBox TDBCheckBox Check a box to show an option has been selected
TComboBox TDBComboBox Select an option from a list and return it (or some custom text) in the main edit box
TEdit TDBEdit Single-line text editing box
TGroupBox TDBGroupBox A container for several related controls
TImage TDBImage A Picture
TListBox TDBListBox A list of string items
TMemo TDBMemo Multiple-line text editing box
TRadioGroup TDBRadioGroup A group of mutually exclusive Radio Buttons; only one at a time may be checked and selected. Note there is no data-aware equivalent of the isolated TRadioButton
TText TDBText A simple text-string, usually read-only
TStringGrid TdbGrid A grid to display information in Rows and Columns

Standard Controls can, of course, be used to display information from a database, but they lack the direct link with the DataSet and its Navigation aids, so the programmer must write explicit code to extract data from the DataSet and put it in the Standard Control

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

Event handler for the case when a control is dragged over another control

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

Event handler for start of dragging process

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

// standard properties, which should be supported by all descendants

Reads the value for colour, or stores the value, and sets a flag if the colour is stored.

The default colour is the same as the window in which the control is located.

// standard properties, which should be supported by all descendants

Reads or Writes flag if bounds are changed

Double-clicking is much more common in a Windows environment than in Unix or Linux, where single-clicking is the default method for selecting an object. However, in all environments there could be valid use for a double-click, and a method should be supplied if appropriate.

// standard properties, which should be supported by all descendants

Determines the border spacing for this control

Reads flag to find stored spacing values required for the border of the control, or writes the flag to set the spacing.

The properties are defined in the parent class TControlBorderSpacing

IsReadOnly - returns True if ReadOnly status is True CMGetDataLink - LCL Message method for getting data link ActiveChange - if the datalink is active then send the changes, otherwise set the data to null UpdateText - copy the new text via the datalink and calls inherited UpdateTExt ActiveChange - if the data link is active, transmit the changed data to the sender ActiveChange - if datalink is active, send back new picture OnLayoutChange - event handler for a change in the layout TDBLookup - used as source of data by TDBLookupListBox or TDBLookupComboBox, to find data from a lookup table

TDBLookup component is typically owned by a Lookup control like TDBLookupListBox or TDBLookupComboBox.

The ListSource is the other dataset TDataSource from which to retrieve the lookup data

The KeyField is the lookup key in the ListSource which corresponds to the DataField value

The ListField is the name of the field in the ListSource to list into the Items property of the lookup control.

Create - constructor for TDBLookup: calls inherited Create, creates links with fields and data source, initialises ActiveChange and Editing properties TComponent.Create Destroy - destructor for TDBLookup: frees links and calls inherited Destroy TComponent.Destroy Initialize makes links between local Fields and the appropriate fields in the remote data source, then fetches the lookup data KeyFieldValueOf - returns a key field value as a string from the given list field ListFieldValueOf - returns a listfield value as a string, given the key field value The name of the KeyField used in the lookup search ListField - the name of the list field used in the lookup search ListFieldIndex - the index value of the list field ListSource - the data source that contains the lookup list TCustomDBListBox - base class for TDBListBox, a data-aware listbox for presenting list information from a database EditingChange - method for responding to a change in the Editing property FocusRequest - method for responding to a request to give this control focus GetDataField - returns the name of the data field as a string GetDataSource - returns the identity of the data source GetField - returns the identity of the field SetItems - copies the specified Values into the Items property TCustomListBox.SetItems GetReadOnly - fetches the ReadOnly status from the field datalink rather than using the inherited ReadOnly status SetReadOnly - changes the datalink ReadOnly property as well as the local property, to that specified by Value SetDataField - links to the field in the datalink with the given name SetDataSource - changes the attached data source to the one specified by AValue CMGetDataLink - control message method for obtaining the data link FDataLink - local variable holding the identity of the field data link DataChange - method for dealing with a change in the data UpdateData - method for applying any pending changes to the data Create - constructor for TCustomDBListBox: calls inherited Create, makes links and sets up event handlers for data change, change in Editing status and updating data CustomListBox.Create Destroy - destructor for TCustomEBListbox: frees data links then calls inherited Destroy CustomListBox.Destroy The identity of the Field to which the listbox belongs The name of the DataField to which the listbox belongs The identity of the DataSource from which the lookup data will be fetched Items - the data that form the list in the box

Items - the data that form the list in the box

We need to overrride the write method for db aware.

The Read isn't an issue since the list will be updated on data change anyway

TCustomListBox.Items
ReadOnly - if True, the data can only be read but not written or edited TDBLookupListBox, a data-aware listbox for presenting lookup list information from a database DataChange - triggered by a change in the data: finds the index of the field containing th changed value TCustomDBListBox.DataChange Create - constructor for TDBLookupListBox: calls inherited Create then creates lookup and forms linkd TCustomDBListBox.Create The KeyField holding the data The ListField for the data ListFieldIndex - the index value for the listfield ListSource - the data source from which the list is obtained TCustomDBComboBox - a Data-aware Combo Box for displaying information from a Database DataChange - updates any changes in text ActiveChange - method to process a change in the Active state EditingChange - method to process a change in the Editing state Change -if there has been a change to the data the link must be notified, then inherited Change is called TCustomComboBox.Change UpdateData - implements any pending changes in the data FocusRequest - sets focus in response to a request to do so EditingDone - updates data through the link, then calls inherited EditingDone The Field to which this combobox is attached The name (as a string) of the Feild whose data are to be linked to the ComboBox The identity of the DataSource to which the ComboBox is attached TDBLookupComboBox - a dataware ComboBox for examining a lookup table from a database UpdateData - copies the local data from the corresponding entry from the lookup field TCustomDBComboBox.UpdateData UpdateText - if the link is active, copies local text from the lookup table, otherwise calls inherited UpdateText Create - constructor fro TDBLookupComboBox: calls inherited Create then makes lookup list, forms links TCustomComboBox.Create KeyField the name of the field containing the key data ListField - the name of the field containing the list data ListFieldIndex - the index value of the field containing the list ListSource the data source that contains the list CMGetDataLink - control message for finding the data link Change - if picture is changes, datalink needs to be informed UpdateDate - implements any pending changes in the date selected CMGetDataLink - control message method for getting the data link