ItemContainer defines an interface which is implemented by all controls which have string subitems each of which may be selected.
It is decomposed in ItemContainerImmutable which omits all methods adding/removing items and is used by RadioBox and ItemContainer itself.
Note that this is not a control, it’s a mixin interface that classes have to derive from in addition to Control or Window.
Examples: ListBox, CheckListBox, Choice and ComboBox (which implements an extended interface deriving from this one)
See also
__init__ | Constructor. |
FindString | Finds an item whose label matches the given string. |
GetCount | Returns the number of items in the control. |
GetSelection | Returns the index of the selected item or NOT_FOUND if no item is selected. |
GetString | Returns the label of the item with the given index. |
GetStringSelection | Returns the label of the selected item or an empty string if no item is selected. |
GetStrings | Returns the array of the labels of all items in the control. |
IsEmpty | Returns True if the control is empty or False if it has some items. |
Select | This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection. |
SetSelection | Sets the selection to the given item n or removes the selection entirely if n == NOT_FOUND . |
SetString | Sets the label for the given item. |
SetStringSelection | Selects the item with the specified string in the control. |
Count | See GetCount |
Selection | See GetSelection and SetSelection |
StringSelection | See GetStringSelection and SetStringSelection |
Strings | See GetStrings |
ItemContainer defines an interface which is implemented by all controls which have string subitems each of which may be selected.
Possible constructors:
ItemContainerImmutable()
Constructor.
Finds an item whose label matches the given string.
Parameters: |
|
---|---|
Return type: | int |
Returns: | The zero-based position of the item, or NOT_FOUND if the string was not found. |
Returns the index of the selected item or NOT_FOUND if no item is selected.
Return type: | int |
---|---|
Returns: | The position of the current selection. |
Note
This method can be used with single selection list boxes only, you should use ListBox.GetSelections for the list boxes with LB_MULTIPLE style.
See also
Returns the label of the item with the given index.
Parameters: | n (int) – The zero-based index. |
---|---|
Return type: | string |
Returns: | The label of the item or an empty string if the position was invalid. |
Returns the label of the selected item or an empty string if no item is selected.
Return type: | string |
---|
See also
Returns the array of the labels of all items in the control.
Return type: | list of strings |
---|
Returns True if the control is empty or False if it has some items.
Return type: | bool |
---|
See also
This is the same as SetSelection and exists only because it is slightly more natural for controls which support multiple selection.
Parameters: | n (int) – |
---|
Sets the selection to the given item n or removes the selection entirely if n == NOT_FOUND .
Note that this does not cause any command events to be emitted nor does it deselect any other items in the controls which support multiple selections.
Parameters: | n (int) – The string position to select, starting from zero. |
---|
See also
Sets the label for the given item.
Parameters: |
|
---|
Selects the item with the specified string in the control.
This method doesn’t cause any command events to be emitted.
Notice that this method is case-insensitive, i.e. the string is compared with all the elements of the control case-insensitively and the first matching entry is selected, even if it doesn’t have exactly the same case as this string and there is an exact match afterwards.
Parameters: | string (string) – The string to select. |
---|---|
Return type: | bool |
Returns: | True if the specified string has been selected, False if it wasn’t found in the control. |
See GetSelection and SetSelection
See GetStringSelection and SetStringSelection
See GetStrings