Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ActiveX Listview (report view) - Header´s Click control
Message
De
11/03/2003 07:43:12
 
 
À
10/03/2003 17:00:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Divers
Thread ID:
00763890
Message ID:
00764118
Vues:
32
This message has been marked as the solution to the initial question of the thread.
Thanks for your reply.. Please, at the columnclick method, we have as parameter a named "columnheader" variable.. So, how could I take this column number clicked, and how do I produce a sort of a giving column number ?

The code below assumes that you have an ImageList assoicated with your ListView by setting the ListView's ColumnHeaderIcons property. This ImageList contains the up arrow and down arrow to use in the column headers as the visual clue for which column is controlling the sort and what direction (ascending or descending) the sort is in.
*** ActiveX Control Event ***
LPARAMETERS columnheader
#define lvwAscending 0
#define lvwDescending 1

*** Check to see if we have clicked on the column header
*** That the list is currently sorted by
*** If so, we want to toggle the SortOrder
IF This.SortKey = ColumnHeader.SubItemIndex
  This.SortOrder = IIF( This.SortOrder = lvwAscending,  lvwDescending, lvwAscending )
  ColumnHeader.Icon = IIF( This.SortOrder = lvwAscending, 1, 2 )
ELSE
  *** user has clicked on new column - initial sort order will become ascending
  *** Remove the icon from the column we were previously sorting by
  *** The SortKey is zero based, so we must add 1 to reference the correct ColumnHeader
  This.ColumnHeaders( This.SortKey + 1 ).Icon = 0
  This.SortOrder = lvwAscending 
  This.SortKey = ColumnHeader.SubItemIndex
  ColumnHeader.Icon = 1
EndIf

ThisForm.Refresh
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform