Combo box

BrowseName: ComboBox
SuperType: Element (Item)
TypeView path: Tipi > UI > Controlli dati > Selezione a discesa

Drop-down selection whose elements are obtained from a model of the project nodes or from one or more database tables.

How It Appears

../../../_images/ref_ComboBox_ex.gif

Applications

Typically used to select an object of interest for which to display/load the data, for example a motor whose data you want to view in a side-by-side table, or a recipe to load on the PLC.

Configuring the object

Set the data source

In the Model property set the parent node of an information model of interest or a database-type object:

  • If a link with a parent node is set, the displayable data are the values of the attributes or properties of all the direct child nodes and the type indicated in the ItemKind property. Typically this refers to a collection of objects with the same or similar information model… Note:: Q Studio automatically sets the ItemKind property with the object type/variable 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, ItemKind is automatically set with the reference to the Motor type. In this case, the values that can be displayed in the different columns are the values of the attributes or properties of the different instances (Motor1, Motor2, Motor3, etc.).

  • If a link is set with a database object, the data that can be displayed are the values contained in its tables.

Set the data to display in the column

Set the Path property of the value displayed:

If the data source is…

Then in the dynamic links window…

a model of nodes

in Aliases > {Item}(object path) the alias of the object set in ItemKind is available. Select the desired attribute or property, then click Select.

a database-type object

in Alias > {Item}(object path) > PointedNode write the name of the desired column of the database table, then click Select.

Set the sorting of data

Depending on the source data, by default the elements are arranged in the same order as the nodes in the model or the rows in the database tables.

With the Sort by property, it is possible to sort the elements independent of the content displayed in the list at runtime. If this is not needed, set Sort by with the same attribute/property or column from which the elements are obtained.

Display the data in real time at runtime

When the data are taken from tables in a database, to display the data updated in real time configure the call of the Update method displayed by the Drop-down selection object. Typically, this method is associated with Button object event.

Properties

Name

BrowseName

DataType

Description

Text

Text

LocalizedText

(Only with Mode=Editable) Text of the written/selected element. Can be used to create customized logics (for example, create new nodes).

Model

Model

NodeId

Reference to the information model or database from which to obtain the data

Selected value

SelectedValue

BaseDataType

Value of the property set in Path of the value selected when an element is selected at runtime.

Selected item

SelectedItem

NodeId

Element selected when the object is initialized at runtime (if empty, it is initialized without selections). After initialization, this property displays the node corresponding to the selected element (access to the property is both read and write when the data are obtained from project nodes, read-only when obtained from a database).

UI selected item

UISelectedItem

NodeId

UI selected value

UISelectedValue

BaseDataType

Allow deselection

AllowDeselection

Boolean

Display value path

DisplayValuePath

LocalizedText

Attribute/property of the nodes or column of a database table whose value is to display in the list. When a value is not assigned, if the model is node-based, the BrowseName of the nodes is displayed; if the model is based on a database, the value of the first cell of each row is displayed, except for queries that further filter the values.

Selected value path

SelectedValuePath

BaseDataType

Property with which to assign a value to the Value property selected at runtime when selecting an element.

Query

Query

String

Standard SQL query to filter the data of interest. It can be used both to filter data from a database and to filter data obtained from a node-based model. In case of a node-based model, the SELECT * FROM Model part is mandatory, followed by the WHERE clause with which to indicate the search conditions - e.g.: SELECT * FROM Model WHERE Speed > 40.

Mode

Mode

ComboBoxModeEnum

Mode of selection of the elements. Normal = selection with click; Normal with text search = selection with click or full typing of an existing element; Editable = selection with click or full typing of an existing or new element.

Font family

FontFamily

Font

Font family

Font weight

FontWeight

FontWeightEnum

Font weight

Font italic

FontItalic

Boolean

Enables/disables italics in the text

Font size

FontSize

Size

Font size

Text color

TextColor

Color

Color of the text to display

Sort order

SortOrder

SortOrderEnum

Default sort order, ascending or descending, of the elements

Order by

OrderBy

NodePath

Attribute/property of the nodes or column of a table by which to sort the elements. Generally the same attribute/property or column from which the elements are obtained is set.

Visible

Visible

Boolean

Show/hide the window.
(Inherited from Element)
Enabled

Enabled

Boolean

Enables/disables the interaction with the user (True = enabled; False = disabled).
(Inherited from Element)
Opacity

Opacity

Float

Opacity level (0 = transparent)
(Inherited from Element)
Left margin

LeftMargin

Size

(Only if Horizontal Alignment = Left or Center or Stretch) Distance between the left edge of the object and the left edge of its container.
(Inherited from Element)
Top margin

TopMargin

Size

(Only if Vertical Alignment = Top or Center or Stretch) Distance between the top edge of the object and the top edge of its container.
(Inherited from Element)
Right margin

RightMargin

Size

(Only if Horizontal Alignment = Right or Center or Stretch) Distance between the right edge of the object and the right edge of its container.
(Inherited from Element)
Bottom margin

BottomMargin

Size

(Only if Vertical Alignment = Bottom or Center or Stretch) Distance between the bottom edge of the object and the bottom edge of its container.
(Inherited from Element)
Width

Width

Size

Width of the window. It can assume values greater than or equal to zero. The Auto value sets the width equal to the width of the content (in this case, in the absence of content the object collapses).
(Inherited from Element)
Height

Height

Size

Height of the window. It can assume values greater than or equal to zero. The Auto value sets the height equal to the height of the content (in this case, in the absence of content the object collapses).
(Inherited from Element)
Horizontal alignment

HorizontalAlignment

HorizontalAlignment

Alignment of the object on the horizontal axis. Left = the left side is positioned on the left side of the container, except for the left margin; Right = the right side is positioned on the right side of the container, except for the right margin; Center = the center of the object is positioned in the center of the container, except for the left and/or right margins; Stretch = object width equals container width, except for the left and/or right margins.
(Inherited from Element)
Vertical alignment

VerticalAlignment

VerticalAlignment

Alignment of the object on the vertical axis. Top = the top side is positioned on the top side of the container, except for the top margin; Bottom = the bottom side is positioned on the bottom side of the container, except for the bottom margin; Center = the center of the object is positioned in the center of the container, except for the top and/or bottom margins; Stretch = object height equals container height, except for the top and/or bottom margins.
(Inherited from Element)
Rotation

Rotation

Size

Rotation of the object around its center point. Positive values indicate clockwise arc degrees.
(Inherited from Element)

Methods

Refresh

BrowseName: Refresh

Events

Selection changed

BrowseName: UserSelectionChanged