A ListBox is a simple list of selectable items.
To create a list box use the <winterpostwiki>wb_create_control</winterpostwiki>() function using ListBox as the class parameter.
Create an empty list box
wb_create_item($window, ListBox, "", 10, 10, 100, 90, ID_LIST);
After creating the list box, you can assign values to the control in several ways:
1) By creating an array to store the item names and using <winterpostwiki>wb_set_text</winterpostwiki>() to assign them to the control:
$a_list = array("Line1", "Line2", "Line3", "Line4");
// Assign values to list box control
wb_set_text(wb_get_control($window, ID_LIST), $a_list);
2) By assigning it a string with items separated by a line break (\n) or line feed/line break sequence: (\r\n):
$s_list = "Line1\nLine2\nLine3"; \\ Or "Line1\r\nLine2\r\nLine3" // Assign values to list box control wb_set_text(wb_get_control($window, ID_LIST), $s_list);
3) By including the desired items when creating a control:
wb_create_item($window, ListBox, "Line1\nLine2\nLine3", 10, 10, 100, 90, ID_LIST);
To associate an integer value with a given item, use <winterpostwiki>wb_set_value</winterpostwiki>(). Set item to the desired item index, or leave it blank (or set it to -1) to associate the value to the currently selected item.
To retrieve the index of the currently selected item, call <winterpostwiki>wb_get_selected</winterpostwiki>(). Use <winterpostwiki>wb_get_value</winterpostwiki>() to retrieve the integer value associated to the specified item, or leave item empty (or set it to -1) to retrieve the value of the currently selected item.