Re: Next couple of questions relating to retrieving an object based on controlID, performing actions, typing in text automatically and event binding

Alberto Buffolino

Jacob Kruger, il 13/01/2021 10.19, ha scritto:
how would I retrieve an instance of an NVDA object based on this controlID?
Hi Jacob,
it may vary, according to specific API (IAccessible, UIA, Java, etc).
A way widely adopted is using NVDAObjects.IAccessible.getNVDAObjectFromEvent( (for IAccessible case). Other useful methods for getting this result can be windowUtils.findDescendantWindow, watchdog.cancellableSendMessage, etc.
def event_gainFocus(self, obj, nextHandler):
  if obj.windowControlID=="1234567890":
    #do something here
I'm not sure about your 4th question. Anyway, the code is correct, but remember to close calling nextHandler(); in some cases, however, you could want to do something before the object creation, that is, before the event: then you have to write something like:
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
if match condition:
clsList.insert(0, NewClass)

class NewClass(...):

def initOverlayClass(self):
#do something, assign gestures, etc
Hth :)

Join to automatically receive all group messages.