vcObservableList<T>

The vcObservableList<T> is practically a simple list/vector of elements of type T, with added OnListChanged event, that the user can subscribe to notice any changes to the list.

Properties

Name Type Access Description
Owner vcObject R List owner. The type depends on context where the list is used.
IsReadOnly Boolean R When true, the contents of this list cannot be changed.

Methods

Name Return Type Parameters Description
size int None Returns number of contained elements
get T Integer index Returns element at index
insert T

Integer index, [T object]

Inserts element into the list.

If called without the object argument, creates a new element in-place.

If called with the object argument, inserts that object

Returns the created or inserted object.

indexOf int T object Returns object’s index, or -1, if not found.
remove Boolean Integer index Returns True on successful removal, otherwise False.
clear None None Removes all contained elements from the container.

Events

Name Parameters Description
OnListChanged vcObservableList<T> list,
Enumeration changeType,
T newItem,
T oldItem,
int newIndex,
int oldIndex

Single event handler for all list content change types.

See Observable List constants for changeType values.

Relevant parameters (T newItem, T oldItem, int newIndex, int oldIndex):

  • VC_LIST_ADD: value, None, index -1
  • VC_LIST_REMOVE: value, None, index, -1
  • VC_LIST_REPLACE: newvalue, oldvalue, index, -1
  • VC_LIST_RESET: None, None, -1, -1