Page 1 of 1

Property Grid: Get items by index

Posted: Mon Aug 06, 2007 3:17 pm
by tkondal
Hi,
I would like to know if it is possible to get the items of a property grid by index instead of by name.

Thanks.

Posted: Tue Aug 07, 2007 9:48 pm
by webops
We have no function for this, but you can do this easily as follows:

Code: Select all

print '  Reading all property names and values'
element=Ranorex.ControlGetElement(propertyGrid)
itemCount = Ranorex.ElementFindChildren(element, Ranorex.ROLE_SYSTEM_ROW)

for index in range(0,itemCount):
    property = Ranorex.ElementGetChildFieldItem(index)
    if property == None:
        print 'Cannot read property' + str(index)
        continue;
    print '    Index = ' + str(index),
    print ' name = ' + Ranorex.ElementGetName(property),
    print ' value = ', Ranorex.ElementGetValue(property)
Jenö
Ranorex Team