| 177 | | action=obj.IAccessibleObject.accDefaultAction(obj.IAccessibleChildID) |
| 178 | | if action: |
| 179 | | try: |
| 180 | | obj.IAccessibleObject.accDoDefaultAction(obj.IAccessibleChildID) |
| 181 | | except: |
| 182 | | l=obj.location |
| 183 | | if l: |
| 184 | | x=(l[0]+l[2]/2) |
| 185 | | y=l[1]+(l[3]/2) |
| 186 | | oldX,oldY=winUser.getCursorPos() |
| 187 | | winUser.setCursorPos(x,y) |
| 188 | | winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None) |
| 189 | | winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None) |
| 190 | | winuser.setCursorPos(oldX,oldY) |
| 191 | | break |
| | 181 | obj.IAccessibleObject.accDoDefaultAction(obj.IAccessibleChildID) |
| 193 | | pass |
| 194 | | obj=obj.parent |
| 195 | | except: |
| | 183 | log.debugWarning("error in calling accDoDefaultAction",exc_info=True) |
| | 184 | raise RuntimeError("error in accDoDefaultAction") |
| | 185 | except: |
| | 186 | log.debugWarning("could not programmatically activate field, trying mouse") |
| | 187 | l=obj.location |
| | 188 | if l: |
| | 189 | x=(l[0]+l[2]/2) |
| | 190 | y=l[1]+(l[3]/2) |
| | 191 | oldX,oldY=winUser.getCursorPos() |
| | 192 | winUser.setCursorPos(x,y) |
| | 193 | winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None) |
| | 194 | winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None) |
| | 195 | winUser.setCursorPos(oldX,oldY) |
| | 196 | else: |
| | 197 | log.debugWarning("no location for field") |
| | 198 | except: |
| | 199 | log.debugWarning("Error activating field",exc_info=True) |