List View (again)
I am still trying to check the state of a CheckBox that is embedded in a ListView control. The list view itself consists of 13 rows and 2 columns. The first column (labeled 'Import') contains the actual CheckBox, while the second column (labeled 'Event') displays text that describe the function of the first. I am using the SQAGetProptery command in an attempt to check all 13 individual CheckBoxes and make sure they are in the right state.
I have tried all of the following techniques:
1) g_nResult = SQAGetProperty("Type=ListView;ObjectIndex=4;\;Type =LVItem;ItemIndex="+sNum, "ListItems("+sCol+").SubItems("+sRow+")", varValue)
2) g_nResult = SQAGetProperty("Type=ListView;ObjectIndex=4;\;Type =LVItem;ItemIndex="+sNum, "ListItems("+sCol+").Text", varValue)
3) g_nResult = SQAGetProperty("Type=ListView;ObjectIndex=4", "ListItems("+sCol+").SubItems("+sRow+")", varValue)
4) g_nResult = SQAGetProperty("Type=ListView;ObjectIndex=4", "ListItems("+sCol+").Text", varValue)
Furthermore, I have tried to get all the children of the ListView via the SQAGetChildren command. This yeilded the following results:
"\;Type=Window;Caption=Daktronics 3000 Rodeo;\;Type=ListView;ObjectIndex=4;\;Type=LVItem; ItemText=TRUE"
The first and third methods are the closest I have gotten since I have stopped receiving the 1002 error (InvalidRecString) and am getting a 1005 (PropertyNotFound). I assume that since Robot found errors in the property string, the recognition string may be right. Hence, my question is, Does anyone know how to extract the state of a CheckBox embedded in a ListView control? With all the ways I have previously mentioned, am I on the right path?
Any feedback is much appreciated.
Re: List View (again)
I had the same problem. What I ended up doing was getting the handle to the ListView control, and using the SendMessage API to see if the item was checked or not. The API looks something like this: Declare Function SendMessage Lib "user32"
Alias "SendMessageA" (ByVal hwnd As Long,ByVal Msg As Long, ByVal wParam As Long, lParam As Any) As Long.
The Msg I passed was LVM_GETITEMSTATE, the wParam was a counter as to the position of the item, and the lParam was LVIS_STATEIMAGEMASK.
The Msg and lParam values are declared as constants. The values are:
Const LVM_GETITEMSTATE As Long = (LVM_FIRST + 44)
Const LVIS_STATEIMAGEMASK As Long = &HF000
Const LVM_FIRST As Long = &H1000
If you think this might work and you want more info on it, let me know.