Locating windows by their control ID - how to do it right

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Locating windows by their control ID - how to do it right

Heiko Folkerts-4
Hi all,
after succeeding in focussing a view that is activated I want to put the focus on it regardless where I am in the application. After digging arround in the archives I found out that one can get a window by calling findDescendantWindow and converting the handle into a NVDAObject. Using getNVDAObjectFromEvent results in the following error message:
DEBUGWARNING - RPC process 7656 (pdshell16.exe) (14:59:54):
Thread 4928, build\x86\remote\sysListView32.cpp, nvdaInProcUtils_sysListView32_getGroupInfo, 28:
LVM_GETGROUPINFOBYINDEX failed

Below I will put the code I am using - any help in making it better or right would be appreciated. I am still quite new to this and I think I am taking every pit fall available. So sorry for that simple questions.

Code:
def script_focusToBrowse(self, gesture):
                try:
                        NVDAObjects.IAccessible.getNVDAObjectFromEvent(windowUtils.findDescendantWindow(api.getForegroundObject().windowHandle,True,1),winUser.OBJID_CLIENT, 0).setFocusj()
                except LookupError:
                        ui.message("Browser is not active.")
                        return

thanks in advance

Heiko


Mit freundlichen Grüßen

Dipl. Inf. (FH)
Heiko Folkerts
Systementwicklung und -Design

--
_______________________________________________________

msg DAVID GmbH · Wendenring 1 · 38114 Braunschweig

Tel.: +49 531 24379-14
Fax.: +49 531 24379-79

E-Mail: mailto:[hidden email]
WWW:    https://www.msg-david.de

Eintragung: Amtsgericht Braunschweig, HRB 3167
Geschäftsführer: Frank Ptok, Andreas Lehmann

_______________________________________________________



------------------------------------------------------------------------------
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Loading...