>>*** ActiveX Control Event *** >>LPARAMETERS columnheader >>this.sortkey = columnheader.Index - 1 >>>
>* When a user clicks on a column header, this procedure fires and is passed >* the ColumnHeader object of the column header that was clicked on. >* This procedure will set the ListView's SortKey property to the >* SubItemIndex value from the ColumnHeader >LPARAMETERS toColumnHeader >DO case >case toColumnHeader.Key = This.ColumnHeaders(ThisForm.nLastSorted + 1).Key > * user has clicked on column currently used for sorting, change SortOrder > >OTHERWISE && different column was clicked > * user has clicked on new column - initial sort order will become ascending > Thisform.nSortOrder = 0 > This.ColumnHeaders(ThisForm.nLastSorted + 1).Icon = 0 >ENDCASE > >DO case > CASE toColumnHeader.Key = [Name] > this.SortKey = 0 > CASE toColumnHeader.Key = [Size] > this.SortKey = 5 > CASE toColumnHeader.Key = [Type] > this.SortKey = 2 > CASE toColumnHeader.Key = [LastModified] > this.SortKey = 4 >endcase > >ThisForm.ListView.SortOrder = thisform.nSortOrder > >toColumnHeader.Icon = IIF(thisform.nSortOrder = 0,1,2) > >thisform.nLastSorted = toColumnHeader.SubItemIndex > >thisform.nSortOrder = IIF(thisform.nSortOrder = 0, 1, 0) >thisform.ListView.Sorted = .T. >ThisForm.Refresh()>