Ranorex

Combobox selecting

 
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython
View previous topic :: View next topic  
Author Message
RPodmore



Joined: 26 Apr 2007
Posts: 1

PostPosted: Thu Apr 26, 2007 3:22 pm    Post subject: Combobox selecting
Hi,

Having some problems getting anything in a combo box selected, in this instance via the WDP Power Options in windows:

def SetTimePeriod(self):

self.active = PropertyPage.PropertyPage()
self.active.SelectTab(POWER_OPTIONS_PROPERTIES, 0)
self.active.SelectComboboxItem(POWER_OPTIONS_PROPERTIES, "Home/Office Desk", 1)

which uses:

def SelectComboboxItem(self, parent, item, instance):
""" Requires the parent window’s title and the name of the combobox item """
""" i.e. SelectComboboxItem(“Display Properties”, "Medium (16 bit)") selects 16bit colour depth in the WDP """
form = Ranorex.FormFindTitle(parent)
ComboBox = Ranorex.FormFindChildClassName(form, 'ComboBox', instance)
Ranorex.ComboBoxSetSelectedText(ComboBox, item)

Please help if you can, what happens is the cursor is seen to move towards the required combo box, then stops at its border, nothing changes or happens and no errors are thrown.
Back to top
View user's profile Send private message Visit poster's website
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Thu Apr 26, 2007 8:43 pm    Post subject:
It's better to use the FormFindChildControlId function in the standard windows dialogs.
(if the Id of the control is a unique identifier).

I tried the following code with the "Display Properties" Dialog and it worked for me:

Code: click into code to enlarge
comboBox = Ranorex.FormFindChildControlId(form,1807)
if comboBox == 0:
    print 'ERROR: comboBox not found'
    return
print '  comboBox = ' + hex(comboBox)
print '   moving the mouse to the comboBox'
Ranorex.MouseMoveToControl(comboBox)

itemcount =  Ranorex.ComboBoxGetItemCount(comboBox)
print '  itemcount=' + str(itemcount)
for i in range(itemcount):
    text = Ranorex.ComboBoxGetItemText(comboBox,i)
    print '    text=' + str(text)
    Ranorex.ComboBoxSetSelectedText(comboBox,text)


Jenö
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> RanorexPython All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum