I have a really basic question: How do I check the values (checked for checkboxes, or selected values for listboxes) for Checkboxes, Textboxes, and Listboxes [if ..then ...] -- specifically, I am looking for the code references in VBScript or C#. Our application is written VFP7.0.
In order to work with the controls of Visual FoxPro applications, you will need to configure the MSAA Open Applications option of your TestComplete project: The option should contain an item corresponding to the window class of your application's windows. Or, you can just enable the '*' item of the option.
Once you do this, TestComplete will add the MSAA group of properties to the controls of your application. Here are some examples using those properties to solve your task:
</font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;"> Set ListBox = w.MSAAObject("list_lstAdd" 'get a reference to the list box control
For i = 0 To ListBox.AChildCount - 1
Set Item = ListBox.AChild(i)
State = Split(Item.State, VbCrLf)
For j = 0 To UBound(State, 1)
If State(j) = "selected" Then
Call Log.Message("Item " & i & " selected"
Set TextBox = w.MSAAObject("editable_text_txtProduct_Name&q uot 'get a reference to the text box control
If TextBox.Value = "My text" Then
Call Log.Message("The text is correct"
Set w1 = w.MSAAObject("cb_Check1" 'get a reference to the check box control
State = Split(w1.State, VbCrLf)
For i = 0 To UBound(State, 1)
If State(i) = "checked" Then
Call Log.Message("The checkbox is checked"
Next</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">Please refer to the "Working With Windows Implementing the IAccessible Interface" and "Project Properties - MSAA Open Applications Options" Help topics to learn more about using the MSAA objects.