Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Olecontrol (list) - date sorting
Message
De
22/09/2003 19:21:04
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Olecontrol (list) - date sorting
Divers
Thread ID:
00831292
Message ID:
00831292
Vues:
43
hi all,

apparently i have a problem when i tried to do sorting based on the date field for olecontrol (listboxex) where when i tried to sort it, it will
be like (looks like being sorted like a numeric value):
(ascending)
HEADER1  HEADER2  HEADER3  HEADER4
xxxxxxx  xxxxxxx  xxxxxxx  19/09/2003
xxxxxxx  xxxxxxx  xxxxxxx  23/09/2003
xxxxxxx  xxxxxxx  xxxxxxx  31/08/2003

(descending)
HEADER1  HEADER2  HEADER3  HEADER4
xxxxxxx  xxxxxxx  xxxxxxx  31/08/2003
xxxxxxx  xxxxxxx  xxxxxxx  23/09/2003
xxxxxxx  xxxxxxx  xxxxxxx  19/09/2003



the code (caller procedure):
...
	.SORTED = .F.
	localobject.MoveFirst()
	x = 1
	IF THISFORM.PopulateRow(x, localobject)
		DO WHILE localobject.MoveNext() = 0
			x = x + 1
			THISFORM.PopulateRow(x, localobject)
		ENDDO
	ENDIF
	.SORTED = .T.
...



'populaterow' section (y = 4):
...
	.SetColumn(x, ;
		TRANSFORM(DAY(localobject.datefield))+"/"+;
		TRANSFORM(MONTH(localobject.datefield))+"/"+;
		TRANSFORM(YEAR(localobject.datefield))), y)
        .SetKey(x, TRANSFORM(localobject.keyID))
...



'setcolumn' procedure of the olecontrol list object:
...
localobject2 = THIS.ListItems(x)
...
localobject2.SubItems(y) = "xxxxxx"
...



in the 'setkey' procedure of the olecontrol list object:
...
localobject3 = THIS.ListItems(x)
localobject3.KEY = "_xxxxxx"
...



and 'columnclick' procedure of the olecontrol list object:
...
IF THIS.SortKey != ColumnHeader.Index - 1
	THIS.SortKey = Columnheader.Index - 1
ELSE
	IF THIS.SortOrder = 0
		THIS.SortOrder = 1
	ELSE
		THIS.SortOrder = 0
	ENDIF
ENDIF
...
i use vfp7 (without service pack).
is it a bug in vfp? or the code has a bug? many thanks in advance...

regards,
Marc
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform