Event WebTable.Data (gb.web.gui)

Event Data ( Row As Integer, Column As Integer, Data As WebTableData )

  • Row

  • Column

  • Data

The Data event triggers for each cell in the table on refresh with Row, Column and a pointer to the WebTableData object.

Add Columns by either using AddColumn or setting WebTable.Columns.Count property.

You add Rows by simply setting the WebTable.Count property.

Then handle filling in the cell data with this event...

Something like this....

(Note: the following is just a code example and using IsDir() in the Data event is probably not such a great idea)

Example 1:

Public sFiles As String[]
 
  Public Sub WebForm1_Open()
 
  WebTable1.Columns.Count = 2
  WebTable1.Columns[0].Text = "Type"
  WebTable1.Columns[1].Text = "Name"

  WebTable1.Columns[0].Width = "5em"
  WebTable1.Columns[1].Expand = True
 
  sFiles = Dir("/readable_dir")
 
  WebTable1.Count = sFiles.Count
 
End
 
Public Sub WebTable1_Data(Row as Integer, Column As Integer, Data As WebTableData)
 
  Select Column
    Case 0
      Data.Text = If(IsDir("/readable_dir" &/ sFiles[Row]), "Dir", "File")
    Case 1
      Data.Text = sFiles[Row]
    End Select
 
End

Or this..

Example 2:


Public Matrix As New Variant[5, 9]  '5 stands for the column, 9 for the row

Public Sub WebForm_Open()

  Dim i as Integer

  WebTable1.Columns.Count = 5
  WebTable1.Count = 9 'can be set dynamically

  For i = 0 To 7
    Matrix[0, i] = "<p align ='left' style='vertical-align:middle'>Col1</p>"
    Matrix[1, i] = "<p align ='left' style='vertical-align:middle'>Col2</p>"
    Matrix[2, i] = "<p align ='left' style='vertical-align:middle'>Col3</p>"
    Matrix[3, i] = "<p align ='right' style='vertical-align:middle'>Col4</p>"
    Matrix[4, i] = "<p align ='right' style='vertical-align:middle'>Col5</p>"
  Next
End

Public Sub WebTable1_Data(Row As Integer, Column As Integer, Data As WebTableData)

   Data.Html = Matrix[Column, Row]

End