KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Resetting a List Box to a blank state
PRODUCT: 4D Backup | VERSION: 12.1 | PLATFORM: Mac & Win
Published On: June 29, 2011

Here is a quick utility method that can be used to reset a List Box to a blank state with no columns:

// UTIL_empty_listbox
If (Count parameters=1)
 C_TEXT($1) // object name of Listbox to empty
 C_LONGINT($a) // for loop counter
 For ($a;1;LISTBOX Get number of columns(*;$1))
  LISTBOX DELETE COLUMN(*;$1;1)
 End for
End if



If the above method is saved as UTIL_empty_listbox and you have a List Box named LBoutput, you could reset the state of the LBoutput List Box with the following line of code:

UTIL_empty_listbox("LBoutput")


This is useful, for example, when populating a List Box with the output of a SQL call and you want to reset the List Box before making another SQL call.