Skip to content

ListBox

flaui.core.automation_elements.ListBox

Bases: AutomationElement

Class to interact with a list box element

items property

Returns all the list box items

Returns:

Type Description
List[ListBoxItem]

List of ListBoxItem elements

selected_item property

Gets the first selected item or null otherwise.

Returns:

Type Description
ListBoxItem

ListBoxItem element if selected, else None

selected_items property

Gets all selected items.

Returns:

Type Description
List[ListBoxItem]

List of ListBoxItem elements

add_to_selection(value)

Add a row to the selection by index/by text.

Parameters:

Name Type Description Default
value Union[str, int]

Text/Index

required

Returns:

Type Description
ListBoxItem

ListBoxItem element

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def add_to_selection(self, value: Union[str, int]) -> ListBoxItem:
    """Add a row to the selection by index/by text.

    :param value: Text/Index
    :return: ListBoxItem element
    """
    return ListBoxItem(raw_element=self.raw_element.AddToSelection(value))

remove_from_selection(value)

Remove a row to the selection by index/by text.

Parameters:

Name Type Description Default
value Union[str, int]

Text/Index

required

Returns:

Type Description
ListBoxItem

ListBoxItem element

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def remove_from_selection(self, value: Union[str, int]) -> ListBoxItem:
    """Remove a row to the selection by index/by text.

    :param value: Text/Index
    :return: ListBoxItem element
    """
    return ListBoxItem(raw_element=self.raw_element.RemoveFromSelection(value))

select(value)

Selects an item by index or text.

Parameters:

Name Type Description Default
value Union[str, int]

Text to select/Index to select by

required

Returns:

Type Description
ListBoxItem

ListBoxItem element

Source code in flaui/core/automation_elements.py
@handle_csharp_exceptions
def select(self, value: Union[str, int]) -> ListBoxItem:
    """Selects an item by index or text.

    :param value: Text to select/Index to select by
    :return: ListBoxItem element
    """
    return ListBoxItem(raw_element=self.raw_element.Select(value))