Forum Discussion
Thanks so much for the reply. You are right, I was told by the dev team here that its a DevExpress grid, the ClrFullClassName is "WinClient.Controls.BasicGrid+ExposedGridControl". I was told by someone at SmartBear that because this is a .Net app, that it should be exposed and I should be able to use some scripts to read the data in it. I read through the Obtaining and Setting Cell Values in Developer Express XtraGrid help topic and am trying to use the below VBSrcipt code, but there seem to be quite a bit of places where I need to plug in values for the grid into the script, there are a lot of "WinFormsObject" referrences in both the script and the full name of the grid, so I'm not sure how to modify the script to work with my grid, the full name of the grid is:
Sys.Process("Client").WinFormsObject("Mdi").WinFormsObject("MdiClient", "").WinFormsObject("FormStart").WinFormsObject("panelView").WinFormsObject("SearchToeView").WinFormsObject("tabControl").WinFormsObject("tabPageBasicSearch").WinFormsObject("searchViewBasic").WinFormsObject("WinClient.Panels.Search.ReqDoc.BasicReqDocQueryPanel_searchResultsGrid").WinFormsObject("gridControl")
Any help on how to plug in these values would be greatly appreciated!
Thanks again,
Tom
Sub Main
Dim p, frmMain, Grid, nColumns, Col
' Obtain the application process and its main form
Set p = Sys.Process("GridTutorials")
Set frmMain = p.WinFormsObject("frmMain")
' Select the "Column Format" demo
frmMain.WinFormsObject("gcNavigations").WinFormsObject("listBoxControl1").SelectedItem = "Column Format"
' Obtain the grid object
Set Grid = frmMain.WinFormsObject("pcMain").WinFormsObject("gcContainer").WinFormsObject("Form1").WinFormsObject("gridControl1")
nColumns = GetColumnCount (Grid, Nothing)
' Post grid cell values to the log
Log.AppendFolder "Cell values in row 0:"
For Col = 0 To nColumns-1
Log.Message aqConvert.VarToStr(GetCellValue (Grid, Nothing, 0, Col))
Next
Log.PopLogFolder
' Post grid cell text to the log
Log.AppendFolder "Cell text in row 0:"
For Col = 0 To nColumns-1
Log.Message GetCellText (Grid, Nothing, 0, Col)
Next
Log.PopLogFolder
End Sub
Function GetCellValue (Grid, View, RowIndex, ColumnId)
Dim Column
' Get the grid view, if it is not specified
If View Is Nothing Then
Set View = Grid.MainView
End If
' Get the column object
Set Column = GetColumn (Grid, View, ColumnId)
' Get the cell value
Set GetCellValue = View.GetRowCellValue(RowIndex, Column)
End Function
Function GetCellText (Grid, View, RowIndex, ColumnId)
Dim Column
' Get the grid view, if it is not specified
If View Is Nothing Then
Set View = Grid.MainView
End If
' Get the column object
Set Column = GetColumn (Grid, View, ColumnId)
' Get the cell text
GetCellText = View.GetRowCellDisplayText(RowIndex, Column).OleValue
End Function
Function GetColumnCount (Grid, View)
If View Is Nothing Then
GetColumnCount = Grid.MainView.Columns.Count
Else
GetColumnCount = View.Columns.Count
End If
End Function
Function GetColumn (Grid, View, ColumnId)
Dim Columns, Col, i
' Get the grid view, if it is not specified
If View Is Nothing Then
Set View = Grid.MainView
End If
Set Columns = View.Columns
' Check if the column is specified by caption or index
If aqObject.GetVarType (ColumnId) = varOleStr Then
' Search for the column by its caption
For i = 0 To Columns.Count-1
Set Col = Columns.Item_2 (i)
If Col.Caption.OleValue = ColumnId Then
Set GetColumn = Col ' The column is found
Exit Function
End If
Next
Set GetColumn = Nothing' The column is not found
Else
' The column is specified by index
Set GetColumn = Columns.Item_2 (ColumnId)
End If
End Function
Related Content
- 11 years ago
Recent Discussions
- 3 days ago