DDO Column Selector

The second root item in the DDO Explorer's treeview comprises the DDO Column Selector. The Column Selector simplifies building components that display data from a database. It enables you to create data-aware controls for the columns of a database table by dragging their names from the Column Selector’s list and dropping them onto the component at their desired locations in the visual designer.

Different elements of the column selector are represented by different icons in the tree. Below is a list of the icons and their meaning:

The Table List

The Column Selector displays the object name of each data dictionary that the component is using. If you are creating a new component that has no data dictionaries then the list is empty.

You can add or remove DDOs from the list via the DDO Structure Editor.

If you double-click the branch representing a DDO in the list then it opens to display all of the columns that belong to the DDO's table.

Below is a key to the icons used in the DDO Column Selector:

 - DDO Column Selector root

 - Table (DDO)

 - Table (Main DDO)

 - Column

Selecting Columns

To select a column to be dragged onto your component, simply click the checkbox next to the column names.

You can select multiple columns from multiple DDOs in the list.

Dragging and Dropping Columns

After you have selected all the columns to create, click and hold the left mouse button over any of the selected columns. Move the mouse over to the Visual Designer view of the component to where you want to drop the first column, and release the mouse button. The columns will be dropped in the order of the list, not the order you selected them.

Notice that when you drag the mouse, the cursor will indicate whether you can drop the control. If it is a cross-hair, you can drop the control, and it will be located at that point. You cannot drop a data-aware control into an non-data-aware container; you will be warned if you make this mistake.

You can also drop the selected columns into the Code Editor of the component you are editing. This will create the data aware control objects at the drop location where you released the mouse. When dropping into the Code Editor the Studio does not try to analyze whether the selected drop location is logically or syntactically correct.

If the columns are dropped onto a cDbCJGrid control, then no controls will be created. Instead the columns will be added to the existing cDbCJGrid columns.

If you are editing a Web View containing a cWebGrid or cWebList, then cWebColumn objects are created.

Automatic Class Selection

The Studio automatically determines the type of control to create for each column, by analyzing the column's data dictionary. The data dictionary information is analyzed in the following way for each column (in order of precedence).

The standard DataFlex classes are used for the visual controls, unless you have defined custom classes as the Workspace's Class Preference.

These factors are listed in order of precedence (i.e., if the first factor is used then the remaining factors are ignored, etc.).

If the columns are dropped onto a cDbCJGrid control, then no controls will be created. Instead the columns will be added to the existing cDbCJGrid columns.

If you are editing a Web View containing a cWebGrid or cWebList, then cWebColumn objects are created.

Automatic Labels

All of the controls created by the Column Selector contain a Label property that sets a descriptive label for the control. When dragging and dropping columns, the Studio will automatically set the Label property for you, based on information analyzed from each column’s data dictionary. The data dictionary information is analyzed in the following way, (for each column in order of precedence).

Grid or List type controls

All non-list type controls (dbForm etc.)

These factors are listed in order of precedence (i.e., if the first factor is used then the remaining factors are ignored, etc.)

Automatic Sizing

All controls that are created by the Column Selector will have their size property (height and width) automatically set, based on information that is analyzed by each column's data dictionary. The following column data will affect the initial size of the control.

Automatic Parent File Selection

A common error when designing components, is to drag and drop a column from a child table that is directly related to a parent table. For example, dropping the Order Number column from the Order Details table instead of the Order Header.

When you are using the DDO Column Selector, the Studio automatically corrects this error.

Using DEO Subclasses

You can override which class will be created when dragging columns from the DDO Column Selector. For example, you may have created a subclass of dbForm that you want to use whenever dragging and dropping from the DDO Column Selector.

To override the default classes select Configure Workspace from the tools menu and edit the appropriate classes on the Class Preferences tab.

See Also

The Visual Designer

DDO Explorer

DDO Structure Editor

Setting a Column's Visual Control