RAD Studio
ContentsIndex
PreviousUpNext
Restricting Field Values with Radio Controls

TDBRadioGroup is a data-aware version of a radio group control. It enables you to set the value of a data field with a radio button control where there is a limited number of possible values for the field. The radio group includes one button for each value a field can accept. Users can set the value for a data field by selecting the desired radio button. 

The Items property determines the radio buttons that appear in the group. Items is a string list. One radio button is displayed for each string in Items, and each string appears to the right of a radio button as the button's label. 

If the current value of a field associated with a radio group matches one of the strings in the Items property, that radio button is selected. For example, if three strings, "Red," "Yellow," and "Blue," are listed for Items, and the field for the current record contains the value "Blue," then the third button in the group appears selected.

Note: If the field does not match any strings in Items, a radio button may still be selected if the field matches a string in the Values property. If the field for the current record does not match any strings in Items or Values, no radio button is selected.
The Values property can contain an optional list of strings that can be returned to the dataset when a user selects a radio button and posts a record. Strings are associated with buttons in numeric sequence. The first string is associated with the first button, the second string with the second button, and so on. For example, suppose Items contains "Red," "Yellow," and "Blue," and Values contains "Magenta," "Yellow," and "Cyan." If a user selects the button labeled "Red," "Magenta" is posted to the database. 

If strings for Values are not provided, the Item string for a selected radio button is returned to the database when a record is posted.

Name 
Description 
The order in which columns appear in the Columns editor is the same as the order the columns appear in the grid. You can change the column order by dragging and dropping columns within the Columns list box. 
When you first place a TDBNavigator on a form at design time, all its buttons are visible. You can use the VisibleButtons property to turn off buttons you do not want to use on a form. For example, when working with a unidirectional dataset, only the First, Next, and Refresh buttons are meaningful. On a form that is intended for browsing rather than editing, you might want to disable the Edit, Insert, Delete, Post, and Cancel buttons. 
Your first level of control over how a grid control draws itself is setting column properties. The grid automatically uses the font, color, and alignment properties of a column to draw the cells of that column. The text of data fields is drawn using the DisplayFormat or EditFormat properties of the field component associated with the column.
You can augment the default grid display logic with code in a grid's OnDrawColumnCell event. If the grid's DefaultDrawing property is True, all the normal drawing is performed before your OnDrawColumnCell event handler is called. Your code can then draw on top of... more 
A customized grid is one for which you define persistent column objects that describe how a column appears and how the data in the column is displayed. A customized grid lets you configure multiple grids to present different views of the same dataset (different column orders, different field choices, and different column colors and fonts, for example). A customized grid also enables you to let users modify the appearance of the grid at runtime without affecting the fields used by the grid or the field order of the dataset.
Customized grids are best used with datasets whose structure is known... more 
A TDBCtrlGrid control displays multiple fields in multiple records in a tabular grid format. Each cell in a grid displays multiple fields from a single row. 
To customize the appearance of grid at design time, you invoke the Columns editor to create a set of persistent column objects for the grid. At runtime, the State property for a grid with persistent column objects is automatically set to csCustomized
You can create a column that displays a drop-down list of values, similar to a lookup combo box control. To specify that the column acts like a combo box, set the column's ButtonStyle property to cbsAuto. Once you populate the list with values, the grid automatically displays a combo box-like drop-down button when a cell of that column is in edit mode.
There are two ways to populate that list with the values for users to select:
  • You can fetch the values from a lookup table. To make a column display a drop-down list of values drawn from... more 
Deleting a persistent column from a grid is useful for eliminating fields that you do not want to display. 
Sometimes the fields of the grid's dataset do not represent simple values such as text, graphics, numerical values, and so on. Some database servers allow fields that are a composite of simpler data types, such as ADT fields or array fields.
There are two ways a grid can display composite fields:
  • It can "flatten out" the field so that each of the simpler types that make up the field appears as a separate field in the dataset.
  • It can display composite fields in a single column, reflecting the fact that they are a single field.
When a composite field is... more 
To display fly-over help for each navigator button at runtime, set the navigator ShowHint property to True. When ShowHint is True, the navigator displays fly-by Help hints whenever you pass the mouse cursor over the navigator buttons. ShowHint is False by default.
The Hints property controls the fly-over help text for each button. By default Hints is an empty string list. When Hints is empty, each navigator button displays default help text. To provide customized fly-over help for the navigator buttons, use the String list editor to enter a separate line of hint text for each button in the Hints... more 
Sometimes you want to display many records in the same form. For example, an invoicing application might show all the orders made by a single customer on the same form.
To display multiple records, use a grid control. Grid controls provide a multi-field, multi-record view of data that can make your application's user interface more compelling and effective. They are discussed in Viewing and editing data with TDBGrid and Creating a grid that contains other data-aware controls.
Note: You can't display multiple records when using a unidirectional dataset.
You may want to design a user interface that displays both... more 
At runtime, you can use a grid to modify existing data and enter new records, if the following default conditions are met:
  • The CanModify property of the Dataset is True.
  • The ReadOnly property of grid is False.
When a user edits a record in the grid, changes to each field are posted to an internal record buffer, but are not posted until the user moves to a different record in the grid. Even if focus is changed to another control on a form, the grid does not post changes until another the cursor for the dataset is moved... more 
A column can display an ellipsis button (...) to the right of the normal cell editor. Ctrl+Enter or a mouse click fires the grid's OnEditButtonClick event. You can use the ellipsis button to bring up forms containing more detailed views of the data in the column. For example, in a table that displays summaries of invoices, you could set up an ellipsis button in the invoice total column to bring up a form that displays the items in that invoice, or the tax calculation method, and so on. For graphic fields, you could use the ellipsis button to bring up... more 
You can modify grid behavior by writing event handlers to respond to specific actions within the grid at runtime. Because a grid typically displays many fields and records at once, you may have very specific needs to respond to changes to individual columns. For example, you might want to activate and deactivate a button elsewhere on the form every time a user enters and exits a specific column.
The following table lists the grid events available in the Object Inspector.
Grid control events  
At runtime you can test a column's AssignedValues property to determine whether a column property has been explicitly assigned. Values that are not explicitly defined are dynamically based on the associated field or the grid's defaults.
You can undo property changes made to one or more columns. In the Columns editor, select the column or columns to restore, and then select Restore Defaults from the context menu. Restore defaults discards assigned property settings and restores a column's properties to those derived from its underlying field component
At runtime, you can reset all default properties for a single column by calling... more 
Column properties determine how data is displayed in the cells of that column. Most column properties obtain their default values from properties associated with another component (called the default source) such as a grid or an associated field component.
To set a column's properties, select the column in The Columns editor and set its properties in the Object Inspector. The following table summarizes key column properties you can set.
Column properties  
You can use the grid Options property at design time to control basic grid behavior and appearance at runtime. When a grid component is first placed on a form at design time, the Options property in the Object Inspector is displayed with a + (plus) sign to indicate that the Options property can be expanded to display a series of Boolean properties that you can set individually. To view and set these properties, click on the + sign. The list of options in the Object Inspector below the Options property. The + sign changes to a –(minus) sign, that collapses... more 
The Stateproperty of the grid's Columns property indicates whether persistent column objects exist for the grid. Columns.State is a runtime-only property that is automatically set for a grid. The default state is csDefault, meaning that persistent column objects do not exist for the grid. In that case, the display of data in the grid is determined primarily by the properties of the fields in the grid's dataset, or, if there are no persistent field components, by a default set of display characteristics.
When the grid's Columns.State property is csDefault, grid columns are dynamically generated from the visible... more 
As with other data-aware controls, a navigator's DataSource property specifies the data source that links the control to a dataset. By changing a navigator's DataSource property at runtime, a single navigator can provide record navigation and manipulation for multiple datasets.
Suppose a form contains two edit controls linked to the CustomersTable and OrdersTable datasets through the CustomersSource and OrdersSource data sources respectively. When a user enters the edit control connected to CustomersSource, the navigator should also use CustomersSource, and when the user enters the edit control connected to OrdersSource, the navigator should switch to OrdersSource as well.... more 
A TDBGrid control lets you view and edit records in a dataset in a tabular grid format.
Three factors affect the appearance of records displayed in a grid control:
  • Existence of persistent column objects defined for the grid using the Columns editor. Persistent column objects provide great flexibility setting grid and data appearance. For information on using persistent columns, see Creating a customized grid.
  • Creation of persistent field components for the dataset displayed in the grid. For more information about creating persistent field components using the Fields editor, see Working with field components.
  • The dataset's ObjectView property setting... more 
TDBNavigator provides users a simple control for navigating through records in a dataset, and for manipulating records. The navigator consists of a series of buttons that enable a user to scroll forward or backward through records one at a time, go to the first record, go to the last record, insert a new record, update an existing record, post data changes, cancel data changes, delete a record, and refresh record display.
The following figure shows the navigator that appears by default when you place it on a form at design time. The navigator consists of a series of buttons that... more 
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!