So I have been searching for an answer for this for a long time, and have come up with a temporary solution which i'll write below, but I was wondering if theres a more elegant one?
In the application im working on there is a weblist which can contain one of four values which are: 10,25,50,100. When a value is selected the web table below should show 10,25,50 or 100 results depending on the value selected of course.
Now when I call the standard Obj.Select "100" for example it changes the list box to 100 but nothing else happens. No event is triggered so the web table below remains the same. If I manually select 100 the web table updates to display 100 records.
I tried firing different events to the web list but none of them seemed to update the web table!
In the end I settled on the solution below:
Public Function CustomSelect(obj, strValue)
Dim intCounter, strProperty, boolItemInList, strEnabledOrDisabled, arrAllItems, strAllItems
Dim xCoord, yCoord
If strValue = "@@" Then
Call AddComment("Passed in @@, skipping set function")
Exit Function
End If
Reporter.Filter = rfEnableErrorsOnly
strProperty= obj.GetTOProperty("name")
If strProperty= "" Then
strProperty= obj.GetTOProperty("html id")
End If
Reporter.Filter = rfEnableAll
If obj.exist(5) Then
XCoord = obj.GetROProperty("abs_x")
YCoord = obj.GetROProperty("abs_y")
strEnabledOrDisabled = obj.GetROProperty("disabled")
If strEnabledOrDisabled = 0 Or strEnabledOrDisabled = "0" Then
strAllItems = obj.GetROProperty("all items")
arrAllItems = split(strAllItems,";")
For intCounter = LBound(arrAllItems) to Ubound(arrAllItems)
'Obj.SendKeys "{DOWN}"
Obj.Select "#" & intCounter
If arrAllItems(intCounter) = strValue Then
Exit For
End If
Next
Else
Call ReportExpectedVsActual("Weblist is disabled: " & strProperty, False, True)
End If
Else
Call ReportExpectedVsActual("Weblist doesnt exist: " & strProperty, True, False)
End If
End Function
RegisterUserFunc "WebList", "CustomSelect", "CustomSelect"
I know it looks a bit messy but its all I can think of to get it working at the moment. Does anyone have any other ideas of what to try?
Cheers
Nick