Data Access User Manual > Rogue Wave Views Data Access Common Framework > Hints and Tips for Using Data Access > Working with DbFields in Data Access > The Style of a DbField
 
The Style of a DbField
A IliDbField object can dynamically change its look and feel. Its style can be any of the following:
*IliEntryFieldStyle
*IliTextStyle
*IliOptionMenuStyle
*IliTableComboBoxStyle
*IliToggleStyle
*IliToggleSelectorStyle
*IliStringListStyle
To change the style of an IliDbField gadget in Rogue Wave Views Studio, you must select the required style from the Style field in the corresponding DbField inspector.
Figure 6.1    Changing the DbField Style in the DbField Inspector
The following sections describe the different styles of a DbField gadget, giving you the best situations to use them in.
IliEntryFieldStyle
This style can be used to display or edit a value of any type. It is not designed to be used with a column that accepts a Boolean value or with a column that has a foreign table. Other styles are better adapted to these two situations.
IliTextStyle
This style is a scrolling text area that can be used to display or edit multiple lines of data. It is not designed to be used with a column that accepts a Boolean value or with a column that has a foreign table. Other styles are better adapted to these two situations.
IliOptionMenuStyle
This style is designed to be used with a column that has a foreign table or with a column that accepts a Boolean value (see Foreign Tables). It consists of a label and a button. The button accesses a menu that contains values to be selected and displayed in the label.
If the DbField is linked to a Boolean value column, the menu contains the options Yes and No, and will not accept any other input.
However, if the column has a foreign table, only the values contained in the menu can be selected in the field.
IliTableComboBoxStyle
This style is designed to be used with a column that has a foreign table or a column that accepts a Boolean value (see Foreign Tables). It consists of an entry field and a button. The button accesses a menu that contains values that can be entered in the field.
Figure 6.2    A DbField with the IliTableComboBoxStyle
If the DbField is linked to a Boolean value column, the menu contains the options Yes and No, and will not accept any other input.
However, if the column has a foreign table and if the Constrained property in the DbField inspector is set to Yes, only the values contained in the menu can be entered in the field.
However, if the Constrained property in the DbField inspector is set to No, values other than those in the menu can be entered directly into the field.
Finally, if the Completion property in the DbField inspector is set to Yes, when one or more characters are entered in the DbField, the option is completed by the appropriate menu entry (provided the characters uniquely define a menu entry).
IliToggleStyle
This style is very similar to the IliDbToggle object. It is a graphical object that enables you to display a state. A toggle usually includes a state marker and a label. The state marker is to the left of the label and indicates whether the state is on or off (according to its Boolean value).
The look of the button depends on the look that has been selected in Rogue Wave Views Studio (Windows, Windows XP, or Motif).
Figure 6.3    A Toggle in Windows95 Look and Feel and a Toggle in Motif Look and Feel
This style is specifically designed to be connected to a table column that has a Boolean value. In this way it can be used to turn the value on or off in the column as required. It should not be used with columns that contain values of other types or with a column that has a foreign table.
There are two ways to create a toggle that is linked to a table object column: either the style of an IliDbField instance can be changed or an instance of IliDbToggle can be created directly.
The IliDbToggle class provides more flexibility regarding the look of the toggle state marker. However, changing the style of an existing IliDbField enables you to create a form using the Forms Assistant and to customize the style of each of the DbField contained in the form.
IliToggleSelectorStyle
This style is specifically designed to be used with a column that has a foreign table mapping. It is a set of toggles that are contained in a frame. Only one of the toggles can be turned on at a time.
Figure 6.4    A DbField with the IliToggleSelectorStyle
Note: This IliToggleSelectorStyle should not be used when the list of values is long since the style becomes difficult to manage.
IliStringListStyle
This style is designed to be used with a column that has a foreign table. It consists of a string list and a string in the list can be selected using the mouse or the keyboard. The strings in the list are read from the foreign table. See Foreign Tables.

Version 6.0
Copyright © 2015, Rogue Wave Software, Inc. All Rights Reserved.