KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Utility method to get info about clicked listbox header
PRODUCT: 4D | VERSION: 18 R2 | PLATFORM: Mac & Win
Published On: May 20, 2020

The following method is a utility method that returns specific information or pointer to the clicked listbox header object.

/* ----------------------------------------------------
  Method: clickedListboxHeader
  Description
    Return a specific info of the clicked listbox column header

  Parameters
    $1 - What to get
----------------------------------------------------*/

C_VARIANT($0)
C_TEXT($1;$toGet_t)
If (Count parameters>=1)
  $toGet_t:=$1

  C_OBJECT($event_o)
  $event_o:=FORM Event
  If ($event_o.code=42) // On Header Click
    Case of
      : ($toGet_t="name")
        $0:=$event_o.headerName
      : ($toGet_t="number")
        $0:=$event_o.column
      : ($toGet_t="title")
        $0:=OBJECT Get title(*;$event_o.headerName)
      : ($toGet_t="pointer")
        $0:=OBJECT Get pointer(Object named;$event_o.headerName)
     End case
  End if
End if


Call examples from a listbox object method.

$headerName:=clickedListboxHeader ("name")
$headerNumber:=clickedListboxHeader ("number")
$headerTitle:=clickedListboxHeader ("title")
$headerPtr:=clickedListboxHeader ("pointer")