Windows Common Control List Methods
- Last UpdatedJul 13, 2023
- 3 minute read
You can use the methods of the Windows common controls to manipulate the controls at run time by using them in scripting.
The following table contains a list of methods you can use in scripting to:
-
Load and save the contents of the Edit Box control from and to a file.
-
Manipulate items in the lists of the List Box control and Combo Box control.
-
Manipulate items in the lists of the List Box control and Combo Box control.
|
Method |
Purpose, syntax and information |
|---|---|
|
AddItem |
Purpose: Add an item (coerced to String) to the list. If the list is sorted, then the new item is inserted at the right position and selected. If the list is unsorted, the item is added to the bottom of the list. Used by: Combo Box, List Box Note: This function does not work when using an Enum or Array to populate the List Box. Syntax: ControlName.AddItem(CaptionString); |
|
Clear |
Purpose: Removes all items from the List. If the list is bound, it clears the bound reference (array or enum). Note: This function does not work when using an Enum or Array to populate the List Box. Used by: Combo Box, List Box Syntax: ControlName.Clear(); |
|
DeleteItem |
Purpose: Accepts an index as a parameter and removes that item from the list. The first item in the list has an index of 0. Used by: Combo Box, List Box Syntax: ControlName.DeleteItem(Index); |
|
DeleteSelection |
Purpose: Delete the currently selected item from the list. Used by: Combo Box, List Box Syntax: ControlName.DeleteSelection(); |
|
FindItem |
Purpose: Accepts a string as a parameter and returns the index of the first item that matches the string. The first item in the list has an index of 0. Used by: Combo Box, List Box Syntax: ControlName.FindItem(SearchString); |
|
GetItem |
Purpose: Returns the item associated with an index supplied as a parameter to this function. The first item in the list has an index of 0. Used by: Combo Box, List Box Syntax: ItemCaption = ControlName.GetItem(Index); |
|
InsertItem |
Purpose: Inserts the supplied string after the current selection in the List. Does not work if list is sorted. Used by: Combo Box, List Box Syntax: ControlName.InsertItem(String); |
|
SetItemData |
Purpose: Associates a value with an item in the list which index is provided to the function. The first item in the list has an index of 0. Note: This function only works when UseValuesAsItems is set to false. It does not work when using an Enum or Array to populate the List Box control. Used by: Combo Box, List Box Syntax: ControlName.SetItemData(Index,Value); |
|
GetItemData |
Purpose: Returns the value associated with the item in the list which index is supplied to the function. The first item in the list has an index of 0. Note: This function only works when UseValuesAsItems is set to false. It does not work when using an Enum or Array to populate the List Box control. Used by: Combo Box, List Box Syntax: Value = ControlName.GetItemData(Index); |
|
LoadList |
Purpose: Loads a list of strings from a file which name is passed as parameter to the function. The default location for files is the users folder, for example: c:\documents and settings\username. Note: The LoadList method does not work when using an Enum or Array to populate the List Box control. Used by: Combo Box, List Box Syntax: ControlName.LoadList(FileName); |
|
LoadText |
Purpose: Loads a text from a file into the Edit Box control. The default location for files is the users folder, for example: c:\documents and settings\username. Used by: Edit Box Syntax: ControlName.LoadText(FileName); |
|
SaveList |
Purpose: Save a list to a file which name is passed as parameter to the function. The default location for files is the users folder, for example: c:\documents and settings\username. Used by: Combo Box, List Box Syntax: ControlName.SaveList(FileName); |
|
SaveText |
Purpose: Saves the current text in the Edit Box control to a file. The default location for files is the users folder, for example: c:\documents and settings\username. Used by: Edit Box Syntax: ControlName.SaveText(FileName); |