def _get__UIAControl(self): if UIAHandler.handler and self.role==controlTypes.ROLE_EDITABLETEXT and controlTypes.STATE_FOCUSED in self.states: e=UIAHandler.handler.clientObject.getFocusedElementBuildCache(UIAHandler.handler.baseCacheRequest) obj=UIA(UIAElement=e) if isinstance(obj,EditableTextWithoutAutoSelectDetection): obj.parent=self.parent obj.TextInfo=UIAMSHTMLTextInfo self._UIAControl=obj return obj
def _get__UIAControl(self): if UIAHandler.handler and self.role==controlTypes.ROLE_EDITABLETEXT and controlTypes.STATE_FOCUSED in self.states: e=UIAHandler.handler.clientObject.getFocusedElementBuildCache(UIAHandler.handler.baseCacheRequest) obj=UIA(UIAElement=e) if isinstance(obj,EditableTextWithoutAutoSelectDetection): obj.parent=self.parent obj.TextInfo=UIAMSHTMLTextInfo self._UIAControl=obj return obj
def event_gainFocus(self): # #3834: UIA has a much better implementation for rows, so use it if available. if self.appModule.outlookVersion<14 or not UIAHandler.handler: return super(SuperGridClient2010,self).event_gainFocus() try: kwargs = {} UIA.kwargsFromSuper(kwargs, relation="focus") obj=UIA(**kwargs) except: log.debugWarning("Retrieving UIA focus failed", exc_info=True) return super(SuperGridClient2010,self).event_gainFocus() if not isinstance(obj,UIAGridRow): return super(SuperGridClient2010,self).event_gainFocus() obj.parent=self.parent eventHandler.executeEvent("gainFocus",obj)
def event_gainFocus(self): # #3834: UIA has a much better implementation for rows, so use it if available. if self.appModule.outlookVersion<14 or not UIAHandler.handler: return super(SuperGridClient2010,self).event_gainFocus() try: kwargs = {} UIA.kwargsFromSuper(kwargs, relation="focus", ignoreNonNativeElementsWithFocus=False) obj = UIA(**kwargs) except Exception: log.error("Retrieving UIA focus failed", exc_info=True) return super(SuperGridClient2010,self).event_gainFocus() if not isinstance(obj,UIAGridRow): return super(SuperGridClient2010,self).event_gainFocus() obj.parent=self.parent eventHandler.executeEvent("gainFocus",obj)
def _get_focusRedirect(self): if self.role==controlTypes.ROLE_UNKNOWN: # The control is inaccessible, try several times to find the CellEdit UIA element with focus and use that instead. for count in xrange(10): if count>=1: api.processPendingEvents(processEventQueue=False) if eventHandler.isPendingEvents("gainFocus"): return time.sleep(0.05) e=UIAHandler.handler.lastFocusedUIAElement if e and e.cachedAutomationID=="CellEdit": obj=UIA(UIAElement=e) oldFocus=api.getFocusObject() if isinstance(oldFocus,ExcelCell): # Set the edit control's parent as the cell that previously had focus. I.e. the cell being edited. # otherwise a whole bunch of UIA focus ancestors for the edit control will be reported. obj.parent=oldFocus # Cache this for as long as this object exists. self.focusRedirect=obj return obj
def _get_focusRedirect(self): if self.role == controlTypes.ROLE_UNKNOWN: # The control is inaccessible, try several times to find the CellEdit UIA element with focus and use that instead. for count in range(10): if count >= 1: api.processPendingEvents(processEventQueue=False) if eventHandler.isPendingEvents("gainFocus"): return time.sleep(0.05) e = UIAHandler.handler.lastFocusedUIAElement if e and e.cachedAutomationID == "CellEdit": obj = UIA(UIAElement=e) oldFocus = api.getFocusObject() if isinstance(oldFocus, ExcelCell): # Set the edit control's parent as the cell that previously had focus. I.e. the cell being edited. # otherwise a whole bunch of UIA focus ancestors for the edit control will be reported. obj.parent = oldFocus # Cache this for as long as this object exists. self.focusRedirect = obj return obj