Are there different types of edit boxes?

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

Are there different types of edit boxes?

Ryan Mann

Hello.  I just started learning how to develop app modules for NVDA using the NVDA developer’s guide.  I tried out the example in the developer guide about getting the length of text in an edit box.  It works for Notepad.  However, I tried it with another program that has an edit box and it doesn’t work.  The program’s executable is perky.exe, so I renamed the .py file perky.py.  Just like I did with notepad.py, I put perky.py in the App Modules directory then restarted NVDA.  The fact that it works with notepad makes me think that my other program has a different type of edit box.  If so, how do I find out what type of edit box this other program has?  If this isn’t the problem, what else could be different?

For reference, I will paste the example code below.

import appModuleHandler

from NVDAObjects.IAccessible import IAccessible

import controlTypes

import ui

 

class AppModule(appModuleHandler.AppModule):

 

                def chooseNVDAObjectOverlayClasses(self, obj, clsList):

                                if obj.windowClassName == "Edit" and obj.role == controlTypes.ROLE_EDITABLETEXT:

                                                clsList.insert(0, EnhancedEditField)

 

class EnhancedEditField(IAccessible):

 

                def script_reportLength(self, gesture):

                                ui.message("The length is ")

                                ui.message("%d" % len(self.value))

 

                __gestures = {

                                "kb:NVDA+l": "reportLength",

                }

Thanks.

 


------------------------------------------------------------------------------
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
|

Re: Are there different types of edit boxes?

James Teh
I'd say this app does not use a Win32 "Edit" control. You can get information about the control by focusing it and pressing NVDA+f1. NVDA will log a whole lot of information about the control, including its windowClassName.

Note that while Win32 Edit controls expose their text as the "value" property, many other types of editable text controls do not. NVDA primarily accesses editable text controls using the TextInfo API. So, if you wanted to get all text and get its length, assuming NVDA has a TextInfo for the control, you might do:
ti = self.makeTextInfo(textInfos.POSITION_ALL)
textLength = len(ti.text)



Jamie

On Fri, Jul 7, 2017 at 8:47 AM, Ryan Mann <[hidden email]> wrote:

Hello.  I just started learning how to develop app modules for NVDA using the NVDA developer’s guide.  I tried out the example in the developer guide about getting the length of text in an edit box.  It works for Notepad.  However, I tried it with another program that has an edit box and it doesn’t work.  The program’s executable is perky.exe, so I renamed the .py file perky.py.  Just like I did with notepad.py, I put perky.py in the App Modules directory then restarted NVDA.  The fact that it works with notepad makes me think that my other program has a different type of edit box.  If so, how do I find out what type of edit box this other program has?  If this isn’t the problem, what else could be different?

For reference, I will paste the example code below.

import appModuleHandler

from NVDAObjects.IAccessible import IAccessible

import controlTypes

import ui

 

class AppModule(appModuleHandler.AppModule):

 

                def chooseNVDAObjectOverlayClasses(self, obj, clsList):

                                if obj.windowClassName == "Edit" and obj.role == controlTypes.ROLE_EDITABLETEXT:

                                                clsList.insert(0, EnhancedEditField)

 

class EnhancedEditField(IAccessible):

 

                def script_reportLength(self, gesture):

                                ui.message("The length is ")

                                ui.message("%d" % len(self.value))

 

                __gestures = {

                                "kb:NVDA+l": "reportLength",

                }

Thanks.

 


------------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Are there different types of edit boxes?

Ryan Mann

I don’t seem to have that function:

File "NVDAObjects\__init__.pyo", line 84, in __call__

  File "C:\Users\rmann\AppData\Roaming\nvda\appModules\perky.py", line 10, in chooseNVDAObjectOverlayClasses

AttributeError: 'AppModule' object has no attribute 'makeTextInfo'

 

 

From: James Teh [mailto:[hidden email]]
Sent: Thursday, July 6, 2017 8:01 PM
To: NVDA screen reader development <[hidden email]>
Subject: Re: [Nvda-devel] Are there different types of edit boxes?

 

I'd say this app does not use a Win32 "Edit" control. You can get information about the control by focusing it and pressing NVDA+f1. NVDA will log a whole lot of information about the control, including its windowClassName.

 

Note that while Win32 Edit controls expose their text as the "value" property, many other types of editable text controls do not. NVDA primarily accesses editable text controls using the TextInfo API. So, if you wanted to get all text and get its length, assuming NVDA has a TextInfo for the control, you might do:

ti = self.makeTextInfo(textInfos.POSITION_ALL)

textLength = len(ti.text)

 

 

 

Jamie

 

On Fri, Jul 7, 2017 at 8:47 AM, Ryan Mann <[hidden email]> wrote:

Hello.  I just started learning how to develop app modules for NVDA using the NVDA developer’s guide.  I tried out the example in the developer guide about getting the length of text in an edit box.  It works for Notepad.  However, I tried it with another program that has an edit box and it doesn’t work.  The program’s executable is perky.exe, so I renamed the .py file perky.py.  Just like I did with notepad.py, I put perky.py in the App Modules directory then restarted NVDA.  The fact that it works with notepad makes me think that my other program has a different type of edit box.  If so, how do I find out what type of edit box this other program has?  If this isn’t the problem, what else could be different?

For reference, I will paste the example code below.

import appModuleHandler

from NVDAObjects.IAccessible import IAccessible

import controlTypes

import ui

 

class AppModule(appModuleHandler.AppModule):

 

                def chooseNVDAObjectOverlayClasses(self, obj, clsList):

                                if obj.windowClassName == "Edit" and obj.role == controlTypes.ROLE_EDITABLETEXT:

                                                clsList.insert(0, EnhancedEditField)

 

class EnhancedEditField(IAccessible):

 

                def script_reportLength(self, gesture):

                                ui.message("The length is ")

                                ui.message("%d" % len(self.value))

 

                __gestures = {

                                "kb:NVDA+l": "reportLength",

                }

Thanks.

 


------------------------------------------------------------------------------
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
Reply | Threaded
Open this post in threaded view
|

Re: Are there different types of edit boxes?

James Teh
I was assuming you were doing this on an NVDAObject overlay class, not the AppModule. If you're doing it on the AppModule, you probably need to do api.getFocusObject().makeTextInfo or similar, depending on what you want.

On Fri, Jul 7, 2017 at 12:23 PM, Ryan Mann <[hidden email]> wrote:

I don’t seem to have that function:

File "NVDAObjects\__init__.pyo", line 84, in __call__

  File "C:\Users\rmann\AppData\Roaming\nvda\appModules\perky.py", line 10, in chooseNVDAObjectOverlayClasses

AttributeError: 'AppModule' object has no attribute 'makeTextInfo'

 

 

From: James Teh [mailto:[hidden email]]
Sent: Thursday, July 6, 2017 8:01 PM
To: NVDA screen reader development <[hidden email]>
Subject: Re: [Nvda-devel] Are there different types of edit boxes?

 

I'd say this app does not use a Win32 "Edit" control. You can get information about the control by focusing it and pressing NVDA+f1. NVDA will log a whole lot of information about the control, including its windowClassName.

 

Note that while Win32 Edit controls expose their text as the "value" property, many other types of editable text controls do not. NVDA primarily accesses editable text controls using the TextInfo API. So, if you wanted to get all text and get its length, assuming NVDA has a TextInfo for the control, you might do:

ti = self.makeTextInfo(textInfos.POSITION_ALL)

textLength = len(ti.text)

 

 

 

Jamie

 

On Fri, Jul 7, 2017 at 8:47 AM, Ryan Mann <[hidden email]> wrote:

Hello.  I just started learning how to develop app modules for NVDA using the NVDA developer’s guide.  I tried out the example in the developer guide about getting the length of text in an edit box.  It works for Notepad.  However, I tried it with another program that has an edit box and it doesn’t work.  The program’s executable is perky.exe, so I renamed the .py file perky.py.  Just like I did with notepad.py, I put perky.py in the App Modules directory then restarted NVDA.  The fact that it works with notepad makes me think that my other program has a different type of edit box.  If so, how do I find out what type of edit box this other program has?  If this isn’t the problem, what else could be different?

For reference, I will paste the example code below.

import appModuleHandler

from NVDAObjects.IAccessible import IAccessible

import controlTypes

import ui

 

class AppModule(appModuleHandler.AppModule):

 

                def chooseNVDAObjectOverlayClasses(self, obj, clsList):

                                if obj.windowClassName == "Edit" and obj.role == controlTypes.ROLE_EDITABLETEXT:

                                                clsList.insert(0, EnhancedEditField)

 

class EnhancedEditField(IAccessible):

 

                def script_reportLength(self, gesture):

                                ui.message("The length is ")

                                ui.message("%d" % len(self.value))

 

                __gestures = {

                                "kb:NVDA+l": "reportLength",

                }

Thanks.

 


------------------------------------------------------------------------------
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



------------------------------------------------------------------------------
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
|

Re: Are there different types of edit boxes?

derek riemer
Note that checking if EditableText is in the clsList might be a better way to override.

On Thu, Jul 6, 2017 at 10:39 PM, James Teh <[hidden email]> wrote:
I was assuming you were doing this on an NVDAObject overlay class, not the AppModule. If you're doing it on the AppModule, you probably need to do api.getFocusObject().makeTextInfo or similar, depending on what you want.

On Fri, Jul 7, 2017 at 12:23 PM, Ryan Mann <[hidden email]> wrote:

I don’t seem to have that function:

File "NVDAObjects\__init__.pyo", line 84, in __call__

  File "C:\Users\rmann\AppData\Roaming\nvda\appModules\perky.py", line 10, in chooseNVDAObjectOverlayClasses

AttributeError: 'AppModule' object has no attribute 'makeTextInfo'

 

 

From: James Teh [mailto:[hidden email]]
Sent: Thursday, July 6, 2017 8:01 PM
To: NVDA screen reader development <[hidden email]>
Subject: Re: [Nvda-devel] Are there different types of edit boxes?

 

I'd say this app does not use a Win32 "Edit" control. You can get information about the control by focusing it and pressing NVDA+f1. NVDA will log a whole lot of information about the control, including its windowClassName.

 

Note that while Win32 Edit controls expose their text as the "value" property, many other types of editable text controls do not. NVDA primarily accesses editable text controls using the TextInfo API. So, if you wanted to get all text and get its length, assuming NVDA has a TextInfo for the control, you might do:

ti = self.makeTextInfo(textInfos.POSITION_ALL)

textLength = len(ti.text)

 

 

 

Jamie

 

On Fri, Jul 7, 2017 at 8:47 AM, Ryan Mann <[hidden email]> wrote:

Hello.  I just started learning how to develop app modules for NVDA using the NVDA developer’s guide.  I tried out the example in the developer guide about getting the length of text in an edit box.  It works for Notepad.  However, I tried it with another program that has an edit box and it doesn’t work.  The program’s executable is perky.exe, so I renamed the .py file perky.py.  Just like I did with notepad.py, I put perky.py in the App Modules directory then restarted NVDA.  The fact that it works with notepad makes me think that my other program has a different type of edit box.  If so, how do I find out what type of edit box this other program has?  If this isn’t the problem, what else could be different?

For reference, I will paste the example code below.

import appModuleHandler

from NVDAObjects.IAccessible import IAccessible

import controlTypes

import ui

 

class AppModule(appModuleHandler.AppModule):

 

                def chooseNVDAObjectOverlayClasses(self, obj, clsList):

                                if obj.windowClassName == "Edit" and obj.role == controlTypes.ROLE_EDITABLETEXT:

                                                clsList.insert(0, EnhancedEditField)

 

class EnhancedEditField(IAccessible):

 

                def script_reportLength(self, gesture):

                                ui.message("The length is ")

                                ui.message("%d" % len(self.value))

 

                __gestures = {

                                "kb:NVDA+l": "reportLength",

                }

Thanks.

 


------------------------------------------------------------------------------
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



------------------------------------------------------------------------------
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




--

Derek Riemer: Improving the world one byte at a time!

  • University of Colorado Boulder Department of computer science, 4th year undergraduate student.
  • Accessibility enthusiast.
  • Proud user of the NVDA screen reader.
  • Open source enthusiast.
  • Skier.

Personal website



------------------------------------------------------------------------------
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