PdcWindow.DataGrids
Jump to navigation
Jump to search
Declaration
DataGrids as PdcDataGrids
Description
Notes
Code example
To get the selected rows of a sub grid (materials or operations in the calculation list) Loop through the grids of the calculation list and show the grid names. Loop through the selected rows of the material and operation datagrid of the calculationlist and shows the selected ID's.
You can use this script on list windows, but also on forms like "Relationcard" to get contacts, "Delivery note" to get certificates, "Invoice" to get payments and so on.
!!! Note !!! Do not use a message box before reading the active window's key values into a stringlist. The click on the message box will change the selection to only the last selected line.
dim objActWin
dim objActGrid
set objActWin = pdc.Windows.ActiveWindow
if objActWin.WindowKey = "32" then
for lngCnt = 0 to objActWin.DataGrids.Count - 1
Memo1.Lines.Add objActWin.DataGrids.items(lngCnt)
next
Memo1.Lines.Add ""
set objActGrid = objActWin.Datagrids.GetGridByName("PDCGrid2", "DM_ID")
Memo1.Lines.Add objActGrid.SelectionKey
for lngCnt = 0 to objActGrid.SelectedValues.Count - 1
Memo1.Lines.Add objActGrid.SelectedValues(lngCnt)
next
Memo1.Lines.Add ""
set objActGrid = objActWin.Datagrids.GetGridByName("PDCGrid3", "DB_ID")
Memo1.Lines.Add objActGrid.SelectionKey
for lngCnt = 0 to objActGrid.SelectedValues.Count - 1
Memo1.Lines.Add objActGrid.SelectedValues(lngCnt)
next
end if
Availability
Available from 4.0 onwards.