Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find Combo Box length?
#1
Not Solved
I've got a drop down box on my screen that contains a list of values and am trying to select one but it's not finding a match because of trailing spaces.

i.e. the list contains values such as:

Code:
Mr     "
"Mrs    "
"Sir    "

The input data I have does not contain trailing spaces so when I try to select it from the drop down it's telling me it can't be found.

If it was the other way round and it was the input that had the trailing spaces i'd simply trim it first but some of these drop down lists in my application can contain hundreds of values and we have thousands of these drop down boxes on our system so don't want to have to code for each one manually!

My solution is to try and find the maximum length of the combo box and add those spaces into my test data. So if I know the combo box is always 20 characters long and my input data is 5 characters I can just write a global function to pad out the remaining spaces.

I've looked in object spy and can find out how many items there are in the list using the item count but can't see anything that tells me the length of the combo box.
Reply
#2
Not Solved
Ideally you are looking for the item string length but not combo length.
Can you please let me know if you are using a function to selection to select the list item in the combobox? If Yes, then the job would be dam easy....
if not then we have another work around for the same...
Are you using any function to select the list item?
Thanks,
SUpputuri
Reply
#3
Not Solved
you can find length property for webedit but there is no property for checking length in combo box
Reply
#4
Not Solved
Managed to solve this in the end but the solution wasn't pretty.

Code:
Private Function fstrComboSpace(pstrDialog, pstrObject, pstrData)
    Dim strComboSpace
    Dim intComboSpace

    strComboSpace = pstrData
    intComboSpace = 0

    Select Case pstrDialog
        Case "Maintain Deal Requirements"
            Select Case pstrObject
                Case "Requirement" intComboSpace = 35
            End Select
    End Select

    If intComboSpace > 0 Then
        intComboSpace = intComboSpace - len(strComboSpace)
        strComboSpace = strComboSpace & space(intComboSpace)
    End If

     fstrComboSpace =  strComboSpace
End Function

So if we know a combo box list does contain trailing spaces we have to add it to the list in this function along with the field size and space fill it so it can find the value in the combo box.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Combo Box selection issue Shkumari 11 12,760 09-26-2013, 03:56 PM
Last Post: learnQtptips
  Unable to select a combo item by value or index martinshort 2 3,567 08-26-2013, 07:55 PM
Last Post: sudhirzpatil
  how to automate combo box in a application using qtp ricks_ngl 0 3,437 07-20-2012, 10:59 AM
Last Post: ricks_ngl
  Default value in Edit Box when Check Box is checked nacchio 2 5,092 07-18-2012, 12:21 PM
Last Post: sree.85
Question insensitive combo-box selection ?? irahulsingh 1 3,588 09-14-2011, 08:12 AM
Last Post: vIns

Forum Jump:


Users browsing this thread: 2 Guest(s)