ArtA
  • ArtA
  • Newbie Topic Starter
2016-01-07T00:54:23Z
I've created a small test app to explore iGrid and xDir

When I add rows to the grid,.AddRow begins adding at row 25.


Private Sub IXDPFoundItemEx_Proc(ByVal ParentFullPath As String, ByVal ItemName As String, ByVal ItemType As xDir200Pro_75B4A91C.EItemTypes, ByVal Attributes As xDir200Pro_75B4A91C.EItemAttributes, ByVal FileSize As Variant, ByVal Created As Date, ByVal Modified As Date, ByVal Accessed As Date, ByVal NodeKey As Long, ByVal ParentNodeKey As Long, CancelEnum As Boolean, ByVal UserValue As Long)
    'add the item to the grid
    Dim lngNewRow As Long
    
    With iGrid1
        lngNewRow = .AddRow
        .CellValue(lngNewRow, 1) = ItemName
        .CellValue(lngNewRow, 2) = FormatNumber(FileSize, 0)
        .CellValue(lngNewRow, 3) = Modified
        
        If ItemType = xditFile Then
            Let .CellIcon(lngNewRow, 1) = 1   'file
        Else
            Let .CellIcon(lngNewRow, 1) = 2   'folder
        End If
    End With
    
End Sub


lngNewRow begins with 25 the first time AddRow is called. And the grid also shows 24 blank lines at the top of the grid. Here are my grid properties setup:



Private Sub Form_Load()

    Me.ScaleMode = vbPixels
    With iGrid1
        .AllowSorting = False
        .ColCount = 3
        .RowCount = 0
        .ColHeaderText(1) = "Name"
        .ColHeaderText(2) = "Size"
        .ColHeaderText(3) = "Last Modified Date"
        .ColWidth(1) = .Width * 0.5
        .ColWidth(2) = .Width * 0.25
        .ColWidth(3) = .Width * 0.25
        .DefaultRowHeight = 18  'needs to be slightly bigger than 16x16 icons we're using
        .Editable = False
        .Enabled = True
        .Font.Name = "Lucida Sans Unicode"
        .Font.Size = 10
        .FullRowSelect = True
        .RowMode = True
        .GridLines = igGridLinesNone
        .HideSelection = False
        .HScrollBar.DisplayMode = igScrollBarDisplayNever
        .VScrollBar.DisplayMode = igScrollBarDisplayNormal
        .MultiSelect = True
        .Virtual = True
        
        .SetImageList (vbalImageList1)
    End With
    
    Set moxDirSource = New xDirPro
    
End Sub

ArtA
  • ArtA
  • Newbie Topic Starter
2016-01-07T01:29:04Z
I found out the cause for the problem. When .Virtual=True, this happens. Is this intentional?
Igor/10Tec
2016-01-07T08:04:54Z
In virtual mode iGrid always requests and adds rows to fill the viewport of the control - unless you stop this in the RequestRow event with its bNoMoreRows parameter passed by reference.

In virtual mode you do not need to add rows yourself using AddRow. iGrid does this work automatically. Read the description of virtual mode in the iGrid help, we have a good description in the Programmer's Guide\Programming Basics section.