Promotic
WikipediaLinkedInYoutubeTwitterFacebook

OnDataUpdate - event of object PmTable

Description:
The event fires on each request for redrawing (e.g. each dragging the scrollbar and each calling the Draw method). It allows among others to read dynamically the table content depending on the scrollbar position; parameters nStartRow, nEndRow say which rows to draw and parameters nStartEmptyRow, nEndEmptyRow say which data of these rows weren't filled up. Thus it is possible in this event either to always fill up all rows (i.e. rows between nStartRow and nEndRow) by the current data or fill up only those rows that weren't filled up by the data (i.e. rows between nStartEmptyRow and nEndEmptyRow), see examples.
Parameters:
pMe(Object) Reference to the PmiAx object that owns this ActiveX. The reference to the ActiveX object itself can be obtained by the pMe.Acx expression.
nStartRow(Long) Index of the first row for redrawing
nEndRow(Long) Index of the last row for the redrawing (including)
nStartEmptyRow(Long) Index of the first row that doesn't contain data for redrawing
nEndEmptyRow(Long) Index of the last row that doesn't contain data for redrawing (including)
Note:
This event is not functional yet for WEB panel.
Example1:

Let's have an example written in the script of this event.

In pMe parameter there is a reference to the PmiAx graphic item (where the PmTable object is located). Let's have 300 variables stored in the PmData object whose current values are changed, for example, every 20 seconds. The table was created apart the script of this event (e.g. oTable.cols=2, oTable.Rows=301, oTable.FixedCols=0, oTable.FixedRows=1). The example always fills up all required rows for redrawing (rows between nStartRow, nEndRow), the table displays always the current data.

The row oTable.SetCellText index+1, 0 has the index increased by 1 because the table has in our case one fixed row reserved for column descriptions.

Dim oData, oTable, index
Set oTable = pMe.Acx
Set oData = pMe.Pm("/Data0")
For index=nStartRow To nEndRow
  oTable.SetCellText index+1, 0, index
  oTable.SetCellText index+1, 1, oData.Vars(index)
Next
Example2:

Let's have an example written in the script of this event.

In pMe parameter there is a reference to the PmiAx graphic item (where the PmTable object is located). Let's have 3000 rows stored in the PmDatabase object that are changed by the time. The table was created apart the script of this event (e.g. oTable.cols=21, oTable.Rows=3001, oTable.FixedCols=0, oTable.FixedRows=1). The example fills up only those rows that haven't been filled up by data yet (rows between nStartEmptyRow, nEndEmptyRow); the table displays the data statically, it reads only those data that weren't viewed yet.

The row oTable.SetCellText index+1, 0 has the index increase by 1 because the table has in our case one fixed row reserved for column descriptions.

Dim oDb, oTable, index
Set oTable = pMe.Acx
Set oDb = pMe.Pm("/Database0")
If nStartEmptyRow > -1 Then
  oDb.MoveTo nStartEmptyRow
  For index=nStartEmptyRow To nEndEmptyRow
    If Not oDb.IsEOF Then
      oTable.SetCellText index+1, 0, index
      oTable.SetCellText index+1, 1, oDb.FieldValues(0)
      oTable.SetCellText index+1, 2, oDb.FieldValues(1)
      ...
      oTable.SetCellText index+1, 20, oDb.FieldValues(20)
      oDb.MoveNext
    End If
  Next
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice