KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Clearing all List Box Columns
PRODUCT: 4D | VERSION: 14 R5 | PLATFORM: Mac & Win
Published On: July 17, 2015

Here is a method to clear all the columns in a List Box:

// ----------------------------------------------------------------------
// Name: LISTBOX_CLEAR_COLUMNS
// Description: Method will clear all the columns in a specified List Box.
//
// Parameters:
// $1 (TEXT) - List Box object name.
// ----------------------------------------------------------------------
C_TEXT($1;$lb_name)
C_LONGINT($i)
C_POINTER($ptr_col)
ARRAY TEXT(arrColNames;0)
ARRAY POINTER(arrColVars;0)

ARRAY TEXT($unused1;0)
ARRAY POINTER($unused2;0)
ARRAY BOOLEAN($unused3;0)
ARRAY POINTER($unused4;0)

$lb_name:=$1

if (Count parameters=1)
   LISTBOX GET ARRAYS(*;$lb_name;arrColNames;$unused1;arrColVars;$unused2;$unused3;$unused4)

    // Clear the columns
   For ($i;1;Size of array(arrColNames)
      CLEAR VARIABLE(arrColVars{$i}->)
   end for

end if


An example of a List Box with five columns of data:



The method used to clear the List Box columns:

LISTBOX_CLEAR_COLUMNS ("List Box")


List Box cleared after using the method: