The DropDownListBox edit style

You can use the DropDownListBox edit style in the Edit property page to have columns display as drop-down lists at runtime:

The sample shows a field labeled department with Business Services displayed and a down arrow to the right. The arrow has been clicked and a list box showing four possible departments has dropped open  beneath the Department field.

Typically, this edit style is used with code tables, where you can specify display values (which users see) and shorter data values (which are stored in the database).

In the DropDownListBox edit style, the display values of the code table display in the ListBox portion of the DropDownListBox. The data values are the values that are put in the DataWindow buffer (and sent to the database when an Update is issued) when the user selects an item in the ListBox portion of the drop-down list.

In the preceding example, when users see the value Business Services, the corresponding data value could be 200.

StepsTo use the DropDownListBox edit style:

  1. Select DropDownListBox from the Style Type box.

  2. Select the appropriate properties.

  3. Enter the value you want to have appear in the Display Value box and the corresponding data value in the Data Value box.

At runtime

You can define and modify a code table for a column in Java code by using the GraphicObjectEditColumn.setCodeTableValue method at runtime. To obtain the value of a column at runtime, use the GraphicObjectEditColumn.getCodeTableValue method. To clear the code table of values, use the GraphicObjectEditColumn.resetCodeTable method.

For example:

GraphicObjectEditColumn editableColumn = (GraphicObjectEditColumn)dw1.getColumnObjectByNumber(1);//get CodeTable value for the columneditableColumn.getCodeTableValue(1);//set CodeTable value for the columnCodeTableValue codeTableValue = new CodeTableValue("1","test");editableColumn.setCodeTableValue(2,codeTableValue);//clear CodeTable valueeditableColumn.resetCodeTable();

For more about code tables, see “Defining a code table”.