Topics

make UIA object focusable and to a button #3030-advice

Christopher Pross
 

Hey guys,
at the moment I have a problem with some add-on code.
I have a element, wich is type "unknown", it is in fact a button, but also it isn't focusable.
The problem is, that I can't change the type or make it focusable. I don't know why, maybe I do somethink wrong?

First of all, the devInfo:

["name: ''", 'role: ROLE_UNKNOWN', 'roleText: None', 'states: ', 'isFocusable: False', 'hasFocus: False', 'Python object: <NVDAObjects.UIA.UIA object at 0x03D6B5F0>', "Python class mro: (<class 'NVDAObjects.UIA.UIA'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'documentBase.TextContainerObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <class 'object'>)", "description: ''", 'location: RectLTWH(left=730, top=133, width=15, height=15)', 'value: None', "appModule: <'nordvpn' (appName 'nordvpn', process ID 11136) at address 758ae30>", "appModule.productName: 'NordVPN'", "appModule.productVersion: '6.26.15.0'", "TextInfo: <class 'NVDAObjects.NVDAObjectTextInfo'>", 'windowHandle: 66774', "windowClassName: 'HwndWrapper[NordVPN.exe;;39c90ffe-7554-4757-a831-d0403c1908a7]'", 'windowControlID: 0', 'windowStyle: 382664704', 'extendedWindowStyle: 262400', 'windowThreadID: 11140', "windowText: 'NordVPN '", "displayText: ''", 'UIAElement: <POINTER(IUIAutomationElement) ptr=0x81a3a20 at d9cacb0>', 'UIA automationID: Sign', 'UIA frameworkID: WPF', 'UIA runtimeID: (7, 11136, 9930698)', 'UIA providerDescription: [pid:11136,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]', 'UIA className: CloseSign', 'UIA patterns available: LegacyIAccessiblePattern, SynchronizedInputPattern']

My add-on code was active in this case already..
In the event_NVDAObject_init, in some if-statements, I have this code:

ch.role = controlTypes.ROLE_BUTTON
ch.states.add(controlTypes.STATE_FOCUSABLE)
ch.isFocusable = True

In the protocol of nvda, is no traceback or exception, no warning or somethink else.
I don't know, why this element don't change his type and the state.
If I try to force to set the focus, I get a traceback, but I think because it isn't focuable:

>>> nav.next.setFocus() Traceback (most recent call last): File "<console>", line 1, in <module> File "NVDAObjects\UIA\__init__.pyc", line 1094, in setFocus File "comtypesMonkeyPatches.pyc", line 26, in __call__ _ctypes.COMError: (-2146233079, None, (None, None, None, 0, None))

Maybe you know what is wrong here?

all the best,
Christopher

Christopher Pross
 

Hey Guys,
I had asked this for a while. Nobody has answered me, if the question is very stupid or I'm wrong here, sorry for that. But I didn't know that.
I have to know, whether this is a bug or this is a failure from my code.
If you need more information, ask here in the group or if it is to many, we can discus this private.

regards,
chriss