Method XbpListBox():getItem() Foundation

Returns the item at the specified position in the list of the XbpListBox object.

:getItem( <nPos> ) --> cItem
<nPos> is a numeric value specifying which item in the list of the XbpListbox object is returned.

This method returns the contents of the specified item as a character string.


The :getItem() method is used to return a single item from the list of the XbpListBox object. This method is often used with :getData()that returns an array containing the numeric indexes of selected items. The following line of code is an example of how an array containing the character strings of all selected items in a list box can be created:

aItems := AEval( oLB:getData(), {|n| n := oLB:getItem(n)}, , ,.T.) 

This expression evaluates a code block for each element of the array returned by :getData(). This array contains numeric indexes in its elements. Each element is passed by reference to the code block (fifth AEval() parameter is .T.). The numeric index is passed on to :getItem(). The return value of :getItem() is assigned to the code block parameter that was passed by reference and originally contained the item position. The result of this code is the array created by :getData() with the numeric indexes replaced by the corresponding character strings from the list of the XbpListBox object.


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.