timing issue with ControlGetState and ElementGetState?

Class library usage, coding and language questions.
jasong
Posts: 49
Joined: Fri Oct 26, 2007 9:38 pm
Location: Texas

timing issue with ControlGetState and ElementGetState?

Post by jasong » Wed Dec 05, 2007 10:55 pm

I am noticing something I just can not explain yet.

When I run my script that checks the state of a control, I am getting for that state a number like '1048577'.

This happens if I use the control or the element.

However, if I step through the code in my IDE (WingIDE) then it correctly returns the state of 1 (unavailable).

I have manually introduced sleep time but that does not seem to do the trick.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11710
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Wed Dec 05, 2007 11:25 pm

When I run my script that checks the state of a control, I am getting for that state a number like '1048577'.
1048577 Dec = 100001 Hex
This means STATE_SYSTEM_UNAVAILABLE & STATE_SYSTEM_FOCUSABLE

If you step through the code, then the control is not focusable, so you get only STATE_SYSTEM_UNAVAILABLE = 1.

The State property has bit flags, you can check the state of an element as follown:

Code: Select all

if state & Ranorex.STATE_SYSTEM_CHECKED:
    print 'Checked'
if state & Ranorex.STATE_SYSTEM_SELECTED:
    print 'Selected'
Jenö
Ranorex Team

jasong
Posts: 49
Joined: Fri Oct 26, 2007 9:38 pm
Location: Texas

Post by jasong » Mon Dec 10, 2007 8:24 pm

awesome!
thank you for your clarification