Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
gb
gb.args
gb.cairo
gb.chart
gb.clipper
gb.complex
gb.compress
gb.crypt
gb.data
gb.db
gb.db.form
gb.db.mysql
gb.db.odbc
gb.db.postgresql
gb.db.sqlite2
gb.db.sqlite3
gb.db2
gb.dbus
gb.dbus.trayicon
gb.debug
gb.desktop
gb.desktop.gnome.keyring
gb.desktop.x11
gb.eval
gb.eval.highlight
gb.form
gb.form.dialog
gb.form.editor
gb.form.htmlview
gb.form.mdi
gb.form.print
gb.form.stock
gb.form.terminal
gb.gmp
gb.gsl
gb.gtk
gb.gtk.opengl
gb.gtk3
gb.gtk3.opengl
gb.gtk3.webview
gb.gui
gb.gui.opengl
gb.gui.qt
gb.gui.qt.ext
gb.gui.qt.opengl
gb.gui.qt.webkit
gb.gui.trayicon
gb.gui.webview
gb.hash
gb.highlight
gb.image
gb.image.effect
gb.image.imlib
gb.image.io
gb.inotify
gb.jit
gb.libxml
gb.logging
gb.map
gb.markdown
gb.media
gb.media.form
gb.memcached
gb.mime
gb.mongodb
gb.mysql
gb.ncurses
gb.net
gb.net.curl
gb.net.pop3
gb.net.smtp
gb.openal
gb.opengl
gb.opengl.glsl
gb.opengl.glu
gb.opengl.sge
gb.openssl
gb.option
gb.pcre
gb.pdf
gb.poppler
gb.qt4
gb.qt4.ext
gb.qt4.opengl
gb.qt4.webkit
gb.qt4.webview
gb.qt5
gb.qt5.ext
gb.qt5.opengl
gb.qt5.webkit
gb.qt5.webview
gb.qt6
gb.qt6.ext
gb.qt6.opengl
gb.qt6.webview
gb.report
gb.report2
gb.scanner
gb.sdl
gb.sdl.sound
gb.sdl2
gb.sdl2.audio
gb.settings
gb.signal
gb.term
gb.test
gb.util
gb.util.web
gb.v4l
gb.vb
gb.web
gb.web.feed
gb.web.form
gb.web.gui
Message
WebButton
WebControl
WebImage
WebTable
AddColumn
Columns
Current
Data
gb.xml
gb.xml.html
gb.xml.rpc
gb.xml.xslt
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Last Changes
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

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