Portman
2012-07-14T11:15:02Z
Hello all, i'm porting a program from 4.7 to 5.0 and i have a problem with the CustomSort event:
After creating the columns of a new grid, i set the property ColSortType(i)=igSortCustom to some columns.
In the v4.7 i had no problem to catch the CustomSort event, in the 5.0 this event seems not to be fired.
The arrow icon in the column headers (only of these custom columns) changes but rows sorting remains unchanged.
If i remove the ColSortType property the columns can be sorted in the default manner (which is not the needed sort).
I've read "10Tec iGrid ActiveX 5.0 What's New in the Release" but it seems there is nothing about.
Perhaps i'm missing something in the sort procedure, any help is welcome!
THX

Fabrizio
Igor/10Tec
2012-07-23T08:39:37Z
We did not change anything in the v5 which could affect custom sorting. Plus the CustomSort sample in our demo works ok.

We admit - it may be a subtle bug, but we need a sample that demonstrates it. Can you prepare and send us one?
Portman
2012-07-29T12:08:51Z
TY for the reply. This problem manifests itself when both the components are referenced by a single project.
However i rebuild a new project with only the new component, adding one form at a time, and now all is ok.

Apart from this smallness this Grid is a very good product!
Igor/10Tec
2012-07-30T07:44:30Z
Understood what's happening, and here is an example of how to reproduce that.

Open a new VB project, and add an instance of iGrid 4.7 to the form. Then the v5.0, and add the following code to test whether CustomSort works. It may be something like that:

Private Sub Form_Load()
   With iGrid470
      .ColCount = 1
      .RowCount = 3
      .ColSortType(1) = igSortCustom
   End With
   With iGrid500
      .ColCount = 1
      .RowCount = 3
      .ColSortType(1) = igSortCustom
   End With
End Sub

Private Sub iGrid470_CustomSort(...)
   Debug.Print "iGrid470_CustomSort", lRow1, lRow2
End Sub

Private Sub iGrid500_CustomSort(...)
   Debug.Print "iGrid500_CustomSort", lRow1, lRow2
End Sub

Now the question: do you really set the 1st column to be custom-sorted in both cases? The answer is "no".

The fact is that the contents of the ESortTypes enum were changed in the v5.0, and its igSortCustom item used to specify custom sorting changed its equivalent numeric value. It was 15 in the v4.7, but now it is 98 in the v5.0. In fact, we use an improper value in either case as VB searches the igSortCustom constant in the same type library (in either iGrid OCX). It is either 15 for both cases, or 98 - and thus only one of the grids will use proper sorting.

If we want to avoid any ambiguity, we should use the type lib name prefix in the setup code:

Private Sub Form_Load()
   With iGrid470
      .ColCount = 1
      .RowCount = 3
      .ColSortType(1) = iGrid470_10Tec.igSortCustom
   End With
   With iGrid500
      .ColCount = 1
      .RowCount = 3
      .ColSortType(1) = iGrid500_10Tec.igSortCustom
   End With
End Sub