Top  | Previous | Next

Dropdown List

A Dropdown showing<br>
a selected value

A Dropdown showing
a selected value

A Dropdown showing<br>
its options

A Dropdown showing
its options

Description

The dropdown component is a great way to display a list of choices in a limited amount of space. The current selection is shown, and the choices are only presented when the user clicks on the dropdown button. The choices that are shown depend on the data property. This is a dataset, which can be typed in manually in the Designer, or (more commonly) it can be populated dynamically from a property binding, often a SQL Query binding.

 

It is often the case that you want to display choices to the user that are 'dressed up' versions of the actual choices. For instance, suppose that you are selecting choices for a downtime tracking entry. The choices might be: "Operator Error", "Machine Malfunction", and "Other". But, you really want to map these choices to some numeric code which is how the choice is stored. So, for instance, when the user chooses "Other" you really want to get the number 3. The dropdown component is perfect for such a use. The data property can be set up in one of three fashions, which control how the "selected values" properties change.

 

The 3 ways to set up the data dataset and the corresponding behavior is as follows:

One Column

[String]

Apples

Oranges

Bananas

Dropdown displays values from the first column
Selected Value is undefined
Selected String Value represents value from first column
Selected Label represents value from first column

 

Two Columns

[Integer, String]

201

Apples

202

Oranges

203

Bananas

Dropdown displays values from second column
Selected Value represents value from first column
Selected String Value is undefined
Selected Label represents value from second column

 

Two Columns

[String, String]

APL

Apples

ORN

Oranges

BAN

Bananas

Dropdown displays values from second column
Selected Value is undefined
Selected String Value represents value from first column
Selected Label represents value from second column

 

The dropdown component can operate in one of three Selection Modes. These modes affect how the dropdown's current selection (defined by the values of its Selected Value, Selected String Value, and Selected Label properties) behave when the selection properties are set to values not present in the choice list, or conversely, when the choice list is set to a new dataset that doesn't contain the current selection:

Strict. Selected values must always correlate to an option in the list defined by the Data property. If an invalid selection is set (via a binding or a script), the selection will be set to the values defined by the No Selection properties. If the Data property is set to a list that does not contain the current selection, the current selection will be reset to the No Selection values.
Lenient. (default) Selected values are independent of the list defined by the Data property. This mode is useful to avoid race conditions that can cause problems in Strict mode when both the Data and the Selected Value properties are bound. If the current selection is not present in the Data list, the read-only property Selected Index will be -1.
Editable. The same selection rules as defined by Lenient mode, except that the dropdown itself becomes editable, allowing a user to type in their own arbitrary value. This value will be set as the dropdown's Selected Label.

 

Properties

Appearance

Font

Font of text of this component

Scripting name

font

Data type

Font

Foreground Color

The foreground color of the component.

Scripting name

foreground

Data type

Color

Background Color

The background color of the component.

Scripting name

background

Data type

Color

Selection Background

The background color of a selected cell in the dropdown list.

Scripting name

selectionBackground

Data type

Color

Flags

expert

Dropdown Display Mode

Changes the dropdown's display

Scripting name

mode

Data type

int

Values

0

List

1

Table

Max Row Count

The number of rows to display in the dropdown list before displaying a scrollbar.

Scripting name

maximumRowCount

Data type

int

Flags

expert

Hide Table Columns?

A comma separated list of columns to hide from the dropdown table, eg. 0,2 (only used in table mode)

Scripting name

hideTableColumns

Data type

String

Flags

expert

Show Table Header?

Selects whether or not the dropdown table header is displayed. (only used in table mode)

Scripting name

showTableHeader

Data type

boolean

Flags

expert

Max Table Width

The maximum width allowed for the dropdown table. (only used in table mode)

Scripting name

maxTableWidth

Data type

int

Flags

expert

Max Table Height

The maximum height allowed for the dropdown table. (only used in table mode)

Scripting name

maxTableHeight

Data type

int

Flags

expert

Antialias

Draw with antialias on? Makes text smoother

Scripting name

antialias

Data type

boolean

Flags

expert

Styles

Contains the component's styles

Scripting name

styles

Data type

Dataset

Flags

bindable | expert

Behavior

Selection Mode

The selection mode determines the behavior of the dropdown: whether its selected value must strictly be in the underlying set of choices, whether it is flexible, or even user-editable.

Scripting name

selectionMode

Data type

int

Values

0

Strict

1

Lenient

2

Editable

No Selection Value

The value when nothing is selected.

Scripting name

noSelectionValue

Data type

int

Flags

expert

No Selection String

The string value when nothing is selected.

Scripting name

noSelectionString

Data type

String

Flags

expert

No Selection Label

The label to display when nothing is selected.

Scripting name

noSelectionLabel

Data type

String

Flags

expert

Common

Name

The name of this component.

Scripting name

name

Data type

String

Flags

bindable

Enabled

If disabled, a component cannot be used.

Scripting name

componentEnabled

Data type

boolean

Visible

If disabled, the component will be hidden.

Scripting name

visible

Data type

boolean

Flags

bindable

Border

The border surrounding this component. NOTE that the border is unaffected by rotation.

Scripting name

border

Data type

Border

Mouseover Text

The text that is displayed in the tooltip which pops up on mouseover of this component.

Scripting name

toolTipText

Data type

String

Cursor

The mouse cursor to use when hovering over this component.

Scripting name

cursorCode

Data type

int

Values

0

Default

1

Crosshair

2

Text

3

Wait

12

Hand

13

Move

4

SW Resize

5

SE Resize

6

NW Resize

7

NE Resize

8

N Resize

9

S Resize

10

W Resize

11

E Resize

Data

Data

The data which fills up the combo box. Either a 1 or 2 column DataSet, with the first column being the value, and the second being the display

Scripting name

data

Data type

Dataset

Flags

bindable

Selected Value

The currently selected value

Scripting name

selectedValue

Data type

Integer

Flags

bindable

Selected String Value

The currently selected value, if the value column is a string

Scripting name

selectedStringValue

Data type

String

Flags

bindable

Selected Label

The currently selected label

Scripting name

selectedLabel

Data type

String

Flags

bindable

Data Quality

The data quality code for any tag bindings on this component.

Scripting name

dataQuality

Data type

int

Flags

bindable | expert

Layout

Horizontal Alignment

Determines the alignment of the contents along the X axis

Scripting name

horizontalAlignment

Data type

int

Flags

expert

Values

2

Left

0

Center

4

Right

10

Leading

11

Trailing

Vertical Alignment

Determines the alignment of the contents along the Y axis

Scripting name

verticalAlignment

Data type

int

Flags

expert

Values

1

Top

0

Center

3

Bottom

Uncategorized

Selected Index

The index of the selected item.

Scripting name

selectedIndex

Data type

int

Flags

bindable | read-only

Scripting

Events

The following event sets are fired by this component. See Component Event Handlers to learn more.

mouse
mouseMotion
focus
propertyChange
key

 

Scripting Functions

This component has no special scripting functions.