TW3ListItems



TW3ListItems

Class used for maintaining items in TW3ListMenu component. Items are stored into TObjectList list which may be managed via methods and properties bellow.


Unit: SmartCL.istMenu.pas

Hierarchy
TObject
TW3OwnedObject
TW3ListItems
Properties
Property-icon.png Count
Property-icon.png Items
Methods
Method-icon.png Add
Method-icon.png Clear
Method-icon.png IndexOf
Method-icon.png Remove
Method-icon.png RemoveByRef

Properties

Property-icon.png Count

Determine number of items inside list menu.

property Count: Integer read getCount;

Property-icon.png Items

Identify TW3ListItem item at specified index. This property is zero-based.

property Items[index: Integer]: TW3ListItem read getItem; default;

Methods

Method-icon.png Add

Create new item at the end of items list, and returns reference to it.

function Add: TW3ListItem;

As this method returns reference to newly created item, it may be set in same line.

Example:

W3ListMenu1.Items.Add.Text:= 'My Item';

Method-icon.png Clear

Delete all items from list. After calling this method, Count property will return 0.

procedure Clear;

Method-icon.png IndexOf

Determine index of item.

function indexOf(aItem: TW3ListItem): Integer;

Parameters:

aItem

TW3ListItem
Item’s reference requesting for index.

Method-icon.png Remove

Remove item with specified index from list. If index in inside bounds, Count property value will be decreased.

procedure Remove(index: Integer);

index

Integer
Index of item (zero-based) to be destroyed and removed from list.


Remarks:

Item is also destroyed. Any outside reference to item will be invalid after this method is called.

Method-icon.png RemoveByRef

Remove item with specified reference (address).

procedure RemoveByRef(aItem: TW3ListItem);

aItem

TW3ListItem
Item’s reference requesting to be deleted.


This method internally calls IndexOf method in order to determine Item’s index. Then, Remove method with obtained index is called.


See also: IndexOf