Made a "catch all" for find element with focus so that any element can be checked

This commit is contained in:
MikeTheWatchGuy 2019-08-16 11:31:21 -04:00
parent 5b1f8cdbca
commit 027f458837
1 changed files with 14 additions and 10 deletions

View File

@ -7045,34 +7045,38 @@ def _FindElementWithFocusInSubForm(form):
matching_elem = _FindElementWithFocusInSubForm(element)
if matching_elem is not None:
return matching_elem
if element.Type == ELEM_TYPE_FRAME:
elif element.Type == ELEM_TYPE_FRAME:
matching_elem = _FindElementWithFocusInSubForm(element)
if matching_elem is not None:
return matching_elem
if element.Type == ELEM_TYPE_TAB_GROUP:
elif element.Type == ELEM_TYPE_TAB_GROUP:
matching_elem = _FindElementWithFocusInSubForm(element)
if matching_elem is not None:
return matching_elem
if element.Type == ELEM_TYPE_TAB:
elif element.Type == ELEM_TYPE_TAB:
matching_elem = _FindElementWithFocusInSubForm(element)
if matching_elem is not None:
return matching_elem
if element.Type == ELEM_TYPE_INPUT_TEXT:
elif element.Type == ELEM_TYPE_INPUT_TEXT:
if element.TKEntry is not None:
if element.TKEntry is element.TKEntry.focus_get():
return element
if element.Type == ELEM_TYPE_INPUT_MULTILINE:
elif element.Type == ELEM_TYPE_INPUT_MULTILINE:
if element.TKText is not None:
if element.TKText is element.TKText.focus_get():
return element
if element.Type == ELEM_TYPE_BUTTON:
elif element.Type == ELEM_TYPE_BUTTON:
if element.TKButton is not None:
if element.TKButton is element.TKButton.focus_get():
return element
if element.Type == ELEM_TYPE_INPUT_LISTBOX:
if element.Widget is not None:
if element.Widget is element.Widget.focus_get():
return element
else: # The "Catch All" - if type isn't one of the above, try generic element.Widget
try:
if element.Widget is not None:
if element.Widget is element.Widget.focus_get():
return element
except:
return None
return None
if sys.version_info[0] >= 3: