It seems to be a problem with ControlGetState() if the control is a top level window.
Please use the function with a child control of the form:
Code: click into code to enlarge
button=Ranorex.FormFindChildControlName(form,'button1')
for i in range(NUMBER_OF_RETRIES):
Ranorex.Sleep(100)
messageState = Ranorex.ControlGetState(button)
print 'state:' + hex(messageState)
if messageState & Ranorex.CONTROL_UNAVAILABLE:
print 'message Form unavailable'
else:
print 'message Form still existing'
or use the position property of the form:
Code: click into code to enlarge
for i in range(NUMBER_OF_RETRIES):
Ranorex.Sleep(100)
location = Ranorex.ControlGetPosition(form)
if location == None:
print 'message Form unavailable'
else:
print 'message Form still existing'
Jenö
Ranorex Team |