Configure a combo box

Configure a combo box to use data from a project node or a database and display selectable items at runtime.
  1. In
    Project view
    , in
    UI
    , right-click a container and select
    New
    Data controls
    Combo box
    .
  2. In
    Properties
    , configure the
    Model
    property. Either:
    • Create a dynamic link between the
      Model
      property and a project node. This obtains values of attributes or properties of all direct child nodes.
      For example, create a dynamic link with the
      Model
      folder with objects that contain data in
      Project view
      . For more information, see Project nodes.
    • Create a dynamic link between the
      Model
      property and a database object in
      Project view
      . This obtains data contained in database tables.
      For example, select an Embedded, ODBC, or InfluxDB database object. For more information, see Database.
    For more information about dynamic links, see Create dynamic links.
  3. (optional) In
    Properties
    , expand
    Model
    and specify the kind of items to display in the object by setting
    Item kind
    .
    TIP:
    The
    Item kind
    property is automatically set with the object or variable type recognized among the child nodes.
    For example, if the model is based on a folder node that contains several instances of a
    Motor
    object type,
    Item kind
    is automatically set with the reference to the
    Motor
    type. In this case, the values that display are the attributes or properties of different instances (
    Motor1
    ,
    Motor2
    ,
    Motor3
    , and so on).
  4. TIP: The following step is optional for data from the project model and required for data from a database.
    In
    Properties
    , in
    Query
    , enter a standard SQL query to filter items obtained from a database or project nodes as specified in
    Model
    .
    For more information, see SQL queries.
    For example:
    SELECT * FROM Model WHERE SPEED > 40
    SELECT * FROM "DataLogger1" WHERE Speed > 40
  5. (optional) In
    Properties
    , from
    Mode
    , select a combo box variant:
    • Normal
      . Select from existing items.
    • Normal with text search
      . Select from existing items or enter complete names of existing items.
    • Editable
      . Select existing items or enter complete names of existing items. To add items, enter new item names.
  6. (optional) In
    Properties
    , create a dynamic link between
    Selected item
    and the item to be selected by default.
    For more information about dynamic links, see Create dynamic links.
  7. (optional) In
    Properties
    , create a dynamic link between
    Selected value
    and the path value to select when a user selects an item.
    For more information about dynamic links, see Create dynamic links.
  8. (optional) In
    Properties
    , set
    Allow deselection
    to
    True
    to enable clearing of selected items in the object.
  9. (optional) In
    Properties
    , configure
    Sorting
    :
    • Sort order
      . Select either
      Ascending
      or
      Descending
      order for elements.
    • Order by
      . Set the node property or table column by which elements are sorted.
      TIP: Use indexed columns for sorting to ensure the best performance of data controls objects at runtime.
  10. (optional) In
    Properties
    , configure
    Appearance
    :
    • Visible
      . Display or hide the combo box at runtime.
    • Enabled
      . Enable or disable user interaction with the combo box at runtime.
    • Opacity
      . Set the combo box opacity from
      0
      (transparent) to
      100
      (opaque).
    • Rotation
      . Rotate the combo box by a specified number of degrees.
    • Input box style
      . Select a graphic style to apply to the combo box input box.
      For more information about style sheets, see Style sheets.
    • DataList style
      . Select a graphic style to apply to the combo box data list.
      For more information about style sheets, see Style sheets.
    • ScrollBar style
      . Select a graphic style to apply to the combo box scrollbar.
      For more information about style sheets, see Style sheets.
  11. (optional) In
    Properties
    or in the editor, configure
    Size and layout
    settings.
    For more information about size and layout properties, see Graphic objects layout.
  12. (optional) In
    Properties
    , configure
    Text and font
    :
    • Text
      . Default combo box text to display when the combo box
      Mode
      is
      Editable
      .
    • Font family
      . Select a font family for the combo box text.
    • Font size
      . Set the font size for the combo box text.
    • Font weight
      . Select a font weight for the combo box text.
    • Font italic
      . Apply italic formatting to the combo box text.
    • Text color
      . Set the color of the combo box text.
  13. (optional) In
    Events
    , associate a method with the
    User selection changed
    event.
    For more information about associating methods with existing events, see Add a method to an existing event.
    For example, display a panel with information about the selected value.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal