Looking for info on searching for a particular control

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

Looking for info on searching for a particular control

Daniel Gartmann

 

Hi,

 

In reading the June 2017 version of the Developer Guide located at:

https://github.com/nvdaaddons/devguide/wiki/NVDA%20Add-on%20Development%20Guide

 

I can’t find info on how to search for a control with specific properties such as particular value.

 

I would like to make a command to read to “to/cc” field in an open message in Outlook similar to what JAWS offers with the Alt+2 to quickly check the recipient of a message.

 

Could the method of looking up a control with certain properties be made into a section in the Developer Guide?

 

Thanks in advance.

 

Daniel

 

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Looking for info on searching for a particular control

Joseph Lee

Hi,

Ah that, this will require that you dig into object navigation/tree traversal to locate the element you are looking for, and once you find it, you would confirm this by pressing NVDA+F1 (developer info) and see info about the object shown on the log viewer.

If I find a general pattern for situations like this, I’ll add a tip about this method in the next revision of the development guide.

Cheers,

Joseph

 

From: Daniel Gartmann [mailto:[hidden email]]
Sent: Monday, July 3, 2017 9:21 PM
To: [hidden email]
Subject: [Nvda-devel] Looking for info on searching for a particular control

 

 

Hi,

 

In reading the June 2017 version of the Developer Guide located at:

https://github.com/nvdaaddons/devguide/wiki/NVDA%20Add-on%20Development%20Guide

 

I can’t find info on how to search for a control with specific properties such as particular value.

 

I would like to make a command to read to “to/cc” field in an open message in Outlook similar to what JAWS offers with the Alt+2 to quickly check the recipient of a message.

 

Could the method of looking up a control with certain properties be made into a section in the Developer Guide?

 

Thanks in advance.

 

Daniel

 

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Looking for info on searching for a particular control

Daniel Gartmann

 

Yes. I have done that manually, copied the info from the log produced by NVDA+F1 into a note.

 

What I need now is a way to tell the add-on that I want to go directly to that particular control and read the text. Something like FindWindow. Would I need to use api.SetNavigatorObject?

 

I paste the log below:

 

 

 

INFO - __main__ (15:17:32.839):

Starting NVDA

INFO - core.main (15:17:33.072):

Config dir: C:\Users\Daniel Gartmann\AppData\Roaming\nvda

INFO - config.ConfigManager._loadConfig (15:17:33.072):

Loading config: C:\Users\Daniel Gartmann\AppData\Roaming\nvda\nvda.ini

INFO - core.main (15:17:33.216):

NVDA version next-14148,5d800c48

INFO - core.main (15:17:33.216):

Using Windows version 10.0.15063 workstation

INFO - core.main (15:17:33.216):

Using Python version 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)]

INFO - core.main (15:17:33.216):

Using comtypes version 0.6.2

INFO - synthDriverHandler.setSynth (15:17:34.174):

Loaded synthDriver vocalizer

INFO - core.main (15:17:34.174):

Using wx version 3.0.2.0 msw (classic)

INFO - brailleInput.initialize (15:17:34.190):

Braille input initialized

INFO - braille.initialize (15:17:34.190):

Using liblouis version 3.2.0

INFO - braille.BrailleHandler.setDisplayByName (15:17:34.210):

Loaded braille display driver freedomScientific, current display has 40 cells.

WARNING - core.main (15:17:34.257):

Java Access Bridge not available

INFO - _UIAHandler.UIAHandler.MTAThreadFunc (15:17:34.257):

UIAutomation: IUIAutomation3

INFO - core.main (15:17:34.888):

NVDA initialized

INFO - config.ConfigManager._loadConfig (15:17:46.993):

Loading config: C:\Users\Daniel Gartmann\AppData\Roaming\nvda\profiles\Engelsk.ini

INFO - synthDriverHandler.setSynth (15:17:47.691):

Loaded synthDriver eloquence

INFO - config.ConfigManager._loadConfig (15:23:04.907):

Loading config: C:\Users\Daniel Gartmann\AppData\Roaming\nvda\profiles\Development with Eloquence.ini

INFO - globalCommands.GlobalCommands.script_navigatorObject_devInfo (15:41:56.618):

Developer info for navigator object:

name: u'Til/Cc'

role: ROLE_EDITABLETEXT

states: STATE_READONLY, STATE_FOCUSABLE, STATE_FOCUSED

isFocusable: True

hasFocus: True

Python object: <NVDAObjects.Dynamic_IAccessibleRichEdit20WindowNVDAObject object at 0x0532EDF0>

Python class mro: (<class 'NVDAObjects.Dynamic_IAccessibleRichEdit20WindowNVDAObject'>, <class 'NVDAObjects.IAccessible.IAccessible'>, <class 'NVDAObjects.window.edit.RichEdit20'>, <class 'NVDAObjects.window.edit.RichEdit'>, <class 'NVDAObjects.window.edit.Edit'>, <class 'NVDAObjects.behaviors.EditableTextWithAutoSelectDetection'>, <class 'NVDAObjects.behaviors.EditableText'>, <class 'editableText.EditableText'>, <class 'NVDAObjects.window.Window'>, <class 'NVDAObjects.NVDAObject'>, <class 'baseObject.ScriptableObject'>, <class 'baseObject.AutoPropertyObject'>, <type 'object'>)

description: None

location: (1851, 499, 282, 32)

value: u'[hidden email]'

appModule: <'outlook' (appName u'outlook', process ID 13440) at address 527f870>

appModule.productName: u'Microsoft Outlook'

appModule.productVersion: u'16.0.8201.2102'

TextInfo: <class 'NVDAObjects.window.edit.ITextDocumentTextInfo'>

windowHandle: 67266

windowClassName: u'RichEdit20WPT'

windowControlID: 4295

windowStyle: 1342277632

windowThreadID: 832

windowText: u' '

displayText: u'[hidden email]'

IAccessibleObject: <POINTER(IAccessible) ptr=0x8a380f0 at 53232b0>

IAccessibleChildID: 0

IAccessible event parameters: windowHandle=67266, objectID=-4, childID=0

IAccessible accName: u'Til/Cc'

IAccessible accRole: ROLE_SYSTEM_TEXT

IAccessible accState: STATE_SYSTEM_READONLY, STATE_SYSTEM_FOCUSED, STATE_SYSTEM_FOCUSABLE, STATE_SYSTEM_VALID (1048644)

IAccessible accDescription: None

IAccessible accValue: u'[hidden email]'

 

*****End of log *****

 

 

 

Fra: Joseph Lee [mailto:[hidden email]]
Sendt: 4. juli 2017 07:14
Til: 'NVDA screen reader development' <[hidden email]>
Emne: Re: [Nvda-devel] Looking for info on searching for a particular control

 

Hi,

Ah that, this will require that you dig into object navigation/tree traversal to locate the element you are looking for, and once you find it, you would confirm this by pressing NVDA+F1 (developer info) and see info about the object shown on the log viewer.

If I find a general pattern for situations like this, I’ll add a tip about this method in the next revision of the development guide.

Cheers,

Joseph

 

From: Daniel Gartmann [[hidden email]]
Sent: Monday, July 3, 2017 9:21 PM
To: [hidden email]
Subject: [Nvda-devel] Looking for info on searching for a particular control

 

 

Hi,

 

In reading the June 2017 version of the Developer Guide located at:

https://github.com/nvdaaddons/devguide/wiki/NVDA%20Add-on%20Development%20Guide

 

I can’t find info on how to search for a control with specific properties such as particular value.

 

I would like to make a command to read to “to/cc” field in an open message in Outlook similar to what JAWS offers with the Alt+2 to quickly check the recipient of a message.

 

Could the method of looking up a control with certain properties be made into a section in the Developer Guide?

 

Thanks in advance.

 

Daniel

 

 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Looking for info on searching for a particular control

James Scholes
Daniel Gartmann wrote:
> What I need now is a way to tell the add-on that I want to go directly
> to that particular control and read the text. Something like FindWindow.

There are a couple of ways to do this:

1. If you can use object navigation from the keyboard, then you can use
object navigation from within your add-on to find the control as well.
You'll need to find a common starting point, so that the CC field can be
located by your code no matter where the user's current focus is.  Open
the NVDA Python Console with NVDA+Control+Z and have a play around with
nav.simpleParent, nav.children, nav.simpleNext, nav.simplePrevious etc.

2. Alternatively, determine an appropriate parent window to start from
and then use the findDescendantWindow function, located in NVDA's
windowUtils module.  You can look at the source code or docstring for
the function to learn more about it, but an important thing to note is
that it returns a window handle (HWND) rather than an NVDA object.  You
can obtain the corresponding NVDA object like this:

import api
from NVDAObjects.IAccessible import getNVDAObjectFromEvent
import windowUtils
import winUser
...
try:
  cc_handle = windowUtils.findDescendantWindow(parent_obj.windowHandle,
visible=True, controlID=4295, className='RichEdit20WPT')
except LookupError:
  # Handle the case when no window was found

cc_field = getNVDAObjectFromEvent(cc_handle, winUser.OBJID_CLIENT, 0)

(where parent_obj is an NVDA object representing the parent of Outlook's
email fields.)

> Would I need to use api.SetNavigatorObject?

NVDA objects have a setFocus method, so on the cc_field object you could
just call setFocus to move the keyboard focus there.  However, if you're
wanting to report the contents of the field to the user, you don't need
to move the focus at all.  Just speak the contents of cc_field.value.
--
James Scholes
http://twitter.com/JamesScholes

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Looking for info on searching for a particular control

Daniel Gartmann

Thanks for these pointers. They definitely are helpful in my learning path.

Daniel


-----Oprindelig meddelelse-----
Fra: James Scholes [mailto:[hidden email]]
Sendt: 4. juli 2017 12:14
Til: NVDA screen reader development <[hidden email]>
Emne: Re: [Nvda-devel] Looking for info on searching for a particular
control

Daniel Gartmann wrote:
> What I need now is a way to tell the add-on that I want to go directly
> to that particular control and read the text. Something like FindWindow.

There are a couple of ways to do this:

1. If you can use object navigation from the keyboard, then you can use
object navigation from within your add-on to find the control as well.
You'll need to find a common starting point, so that the CC field can be
located by your code no matter where the user's current focus is.  Open the
NVDA Python Console with NVDA+Control+Z and have a play around with
nav.simpleParent, nav.children, nav.simpleNext, nav.simplePrevious etc.

2. Alternatively, determine an appropriate parent window to start from and
then use the findDescendantWindow function, located in NVDA's windowUtils
module.  You can look at the source code or docstring for the function to
learn more about it, but an important thing to note is that it returns a
window handle (HWND) rather than an NVDA object.  You can obtain the
corresponding NVDA object like this:

import api
from NVDAObjects.IAccessible import getNVDAObjectFromEvent import
windowUtils import winUser ...
try:
  cc_handle = windowUtils.findDescendantWindow(parent_obj.windowHandle,
visible=True, controlID=4295, className='RichEdit20WPT') except LookupError:
  # Handle the case when no window was found

cc_field = getNVDAObjectFromEvent(cc_handle, winUser.OBJID_CLIENT, 0)

(where parent_obj is an NVDA object representing the parent of Outlook's
email fields.)

> Would I need to use api.SetNavigatorObject?

NVDA objects have a setFocus method, so on the cc_field object you could
just call setFocus to move the keyboard focus there.  However, if you're
wanting to report the contents of the field to the user, you don't need to
move the focus at all.  Just speak the contents of cc_field.value.
--
James Scholes
http://twitter.com/JamesScholes

----------------------------------------------------------------------------
--
Check out the vibrant tech community on one of the world's most engaging
tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Nvda-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nvda-devel
Loading...