Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.19

Description

Description:This inserts into a listbox an element at a specified index. The index of the inserted element is returned (and can be different from the desired index, if that index does not exist).
Inserted lines always reserve space for an image at the left edge, so pure text lines show up indented.

Syntax

Syntax:[control, text, index] call fn_vbs_lbInsert
Parameters:
  • control: Control - Listbox control.
  • text: String - Text of new listbox element to insert.
  • index: Number - Index at which to insert new element.
Return Value:Number

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
// A listbox has 4 elements: "A", "B", "C", "D"
[listbox, "E", 2] call fn_vbs_lbInsert
// The listbox now contains: "A", "B", "E", "C", "D"

Additional Information

See also:
Multiplayer:
Problems:

Notes






Due to an obscure bug, this function will
not
work on listboxes that have elements using images located in the mission folder (as opposed to located inside of a pbo/ebo file). If the listbox has no images (set with
lbSetPicture
, the function will run fine.


This function should also not be used on listboxes where some elements have pictures, and some do not. In this case, text indenting will be unpredictable. - 24 June 2008, 22:50, General Barron