HTH:

  // UtyLB_SaveUserSort(tListBox;->tHeaderName;->lSortOrder)
  // ----------------------------------------------------
  // User name (OS): Olivier Flury - FLURY SOFTWARE
  // Date and time: 19.07.16, 12:49:33
  // ----------------------------------------------------
  // Method: UtyLB_SaveUserSort
  // Description
  // Place this method in the context of the form event On After Sort of a 
listbox.
  // This method sets the header object name of the sorted column and the sort 
order in the variables as passed in $2 and $3
  // See also the method UtyLB_SetUserSort
  //
  // Parameters:
  // $1, text, object name of the listbox of which to save the user sort
  // $2, pointer to text variable where to save the object name of the header 
of the sorted column
  // $3, pointer to numeric variable where to save the sort order: 1 = 
ascending sort, 2 = descending sort
  // ----------------------------------------------------

C_TEXT($1;$tListBox)
C_POINTER($2;$3;$p2tHeaderName;$p2lSortOrder;$p2OneHeader)
C_LONGINT($i;$n)

ARRAY TEXT($atCol;0)
ARRAY TEXT($atHead;0)
ARRAY POINTER($ap2Col;0)
ARRAY POINTER($ap2Head;0)
ARRAY BOOLEAN($abVisible;0)
ARRAY POINTER($ap2Style;0)

$tListBox:=$1
$p2tHeaderName:=$2
$p2lSortOrder:=$3

LISTBOX GET 
ARRAYS(*;$tListBox;$atCol;$atHead;$ap2Col;$ap2Head;$abVisible;$ap2Style)

$n:=Size of array($ap2Head)

For ($i;1;$n)

$p2OneHeader:=$ap2Head{$i}

If ($p2OneHeader->#0)

$p2lSortOrder->:=$p2OneHeader->

$p2tHeaderName->:=$atHead{$i}

$i:=$n+1

End if 

End for 

  // end of method


-------------------------------------------------------------------

  // UtyLB_SetUserSort(tListBox;tHeaderName;lSortOrder)
  // ----------------------------------------------------
  // User name (OS): Olivier Flury - FLURY SOFTWARE
  // Date and time: 15.07.16, 14:03:00
  // ----------------------------------------------------
  // Method: UtyLB_SetUserSort
  // Description
  // Sorts a listbox. See the method UtyLB_SaveUserSort
  //
  // Parameters:
  // $1, text, object name of the listbox
  // $2, text, object name of header of column to sort
  // $3, longint, sort order 1 = ascending sort, 2 = descending sort
  // ----------------------------------------------------

C_TEXT($1;$2;$tListBox;$tHeaderName)
C_LONGINT($3;$lSortOrder;$lWhere)

$tListBox:=$1
$tHeaderName:=$2
$lSortOrder:=$3

Case of 
                
: ($tHeaderName="")

  // do nothing

: (($lSortOrder#1) & ($lSortOrder#2))

  // do nothing

Else 

ARRAY TEXT($atCol;0)
ARRAY TEXT($atHead;0)
ARRAY POINTER($ap2Col;0)
ARRAY POINTER($ap2Head;0)
ARRAY BOOLEAN($abVisible;0)
ARRAY POINTER($ap2Style;0)

LISTBOX GET 
ARRAYS(*;$tListBox;$atCol;$atHead;$ap2Col;$ap2Head;$abVisible;$ap2Style)

$lWhere:=Find in array($atHead;$tHeaderName)

Case of 

: ($lWhere<=0)

  // do nothing

: ($lSortOrder=1)  // ascending sort

LISTBOX SORT COLUMNS(*;$tListBox;$lWhere;>)  //  ">" to sort in ascending order 
or "<" to sort in descending order

: ($lSortOrder=2)  // descending sort

LISTBOX SORT COLUMNS(*;$tListBox;$lWhere;<)

End case 

End case 

  // end of method

|||||| https://flury-software.ch/

-----Ursprüngliche Nachricht-----
Von: 4D_Tech <4d_tech-boun...@lists.4d.com> Im Auftrag von stardata.info via 
4D_Tech
Gesendet: Mittwoch, 16. Januar 2019 10:05
An: 4d_tech@lists.4d.com; 4d_tech-requ...@lists.4d.com
Cc: stardata.info <stard...@stardata.info>
Betreff: ON AFTER SORT

Hi All,

I use 4D V16 on windows.

I need to know if one sort in my listbox are used (by click on column).

With event "on after sort" I can trap the click on the column in a sortable 
listbox, but I need even to

know what column is clicked and the sort order of this column.

Someone have done already?


Thanks

Ferdinando

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************
  • ON AFTER SORT stardata.info via 4D_Tech
    • AW: ON AFTER SORT Olivier Flury via 4D_Tech

Reply via email to