Tech Tip: Method to retrieve names of listbox columns, headers, or footers
PRODUCT: 4D | VERSION: 14.1 | PLATFORM: Mac & Win
Published On: September 3, 2014
The method below can be used to retrieve the names of either the columns, headers, or footer in a listbox. It uses the command LISTBOX GET OBJECTS to retrieve all objects, and then finds only the names of the desired object (column, header, or footer).
// Method: ListboxGetNames // Parameters // $1 - Pointer to Listbox Object // $2 - Array to return values // $3 - "columns" , "headers", or "footers" // // Return // $0 - current width or height of a form // ---------------------------------------------------- If (Count parameters=3) C_LONGINT($choice;$selectElement) C_POINTER($1;$2;$LB;$arrNames) C_TEXT($3) $LB:=$1 $arrNames:=$2 ARRAY TEXT($arrAllObjects;0) LISTBOX GET OBJECTS($LB->;$arrAllObjects) Case of : ($3="footers") $choice:=0 : ($3="headers") $choice:=1 : ($3="columns") $choice:=2 End case For ($i;1;Size of array($arrAllObjects)) $selectElement:=Mod($i;3) If ($selectElement=0) APPEND TO ARRAY($arrNames->;$arrAllObjects{$i-$choice}) End if End for End if |
Here is an example of using the method:
ListboxGetNames (->LB;->$arrColumns;"Columns") ListboxGetNames (->LB;->$arrHeaders;"Headers") ListboxGetNames (->LB;->$arrFooters;"Footers") |