Property Grid: Get items by index

Class library usage, coding and language questions.
tkondal
Posts: 24
Joined: Fri Nov 03, 2006 5:50 pm

Property Grid: Get items by index

Post by tkondal » Mon Aug 06, 2007 3:17 pm

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.

webops
Site Admin
Site Admin
Posts: 349
Joined: Wed Jul 05, 2006 7:44 pm

Post by webops » Tue Aug 07, 2007 9:48 pm

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