Re: Recreating focused object after execution of NVDAObject.clearDynamicClassCache()

derek riemer

Trying to rebuild the focus object is going to be challenging. I didn't didn't even try to get around this with my addon. Just conditionally enable or disable your script by delegating to the parent objects.

On Mon, Dec 2, 2019 at 5:32 AM Leonard de Ruijter <alderuijter@...> wrote:

Dear Lukasz,

The problem with clearDynamicClassCache is that it touches the cache for all dynamic classes, including those specific to NVDA or other add-ons. So, calling clearDynamicClassCache might have unintended side effects to NVDA core.



On 30-11-2019 21:25, Lukasz Golonka wrote:
The only reason why I've tried to write it in such a way that overlay is
added only when translation is active was the fact that the class was
present in the MRO for every edit field, and making it cleaner looked as
a nice idea. As the approach with clearDynamicClassCache almost work it
might be nice to make it fully working.  Perhaps it is not worth the

On Sat, 30 Nov 2019 19:47:34 +0100
"Leonard de Ruijter" <alderuijter@...> wrote:

In that case, why don't you simply leave the script as is, i.e. add the overlay to every single edit field and apply the workarounds based on your enabled/disabled flag? I think this approach makes sense. Trying to improve this in such a way that requires you to call clearDynamicClassCache only seems to make the code more complex and error-prone while not significantly improving something. Or I must be something here?


On 29-11-2019 20:31, Lukasz Golonka wrote:

Yes, that is exactly what I want to do. On Fri, 29 Nov 2019 19:52:37 +0100 "Leonard de Ruijter" <mailto:alderuijter@...><alderuijter@...> wrote: 
Lukasz, So, just to make sure before I elaborate further. when I understand you correctly, you want the overlay class to be present as soon as you execute the script, and get rid of the overlay when you execute the script again or another script? Regards, Leonard On 29-11-2019 12:23, Lukasz Golonka wrote: 
This plugin works as follows: There is a class with some overwritten gestures and methods which makes translation from LaTeX to speech and braille working when caret moves. In chooseNVDAObjectOverlayClasses it checks for type of control, and for a value of a variable signaling if translation should be active or not. This variable is switchable by a user with a script which checks if caret is in a edit field, and if it is sets the variable accordingly. It also executes NVDAObject.clearDynamicClassCache(), so yes I want to recreate object with caret unconditionally when this script executes. On Fri, 29 Nov 2019 08:21:28 +0100 "Leonard de Ruijter" <mailto:alderuijter@...><alderuijter@...> wrote: 
Dear Lukasz, Honestly, it's not clear to me what you're trying to do, i.e. why do you want to recreate the focus object anyway? How do you distinguish the edit field you like to support from the one you want to ignore? Regards, Leonard Op 29-11-2019 om 00:39 schreef Lukasz Golonka: Hi all, At the moment I am improving a plugin which makes NVDA work with LaTeX_Access. In its previous version class in which all scripts are defined was added to MRO of each edit fields even if translation of LaTeX to more verbal form was disabled. The simplest approach to fix this seemed to execute NVDAObject.clearDynamicClassCache() after switching translation on or off, and it almost works. The only problem is that as long as focus is not moved the LaTeX_Access class is still active for the currently focused edit field. Is there any way of forcing focused object to recreate? Alternatively is there a better way to achieve what I want to do? 



Derek Riemer
Improving the world one byte at a time!        ⠠⠊⠍⠏⠗⠕⠧⠬ ⠮ ⠸⠺ ⠐⠕ ⠃⠽⠞⠑ ⠁⠞ ⠁ ⠐⠞⠖
•    Accessibility enthusiast.
•    Proud user of the NVDA screen reader.
•    Open source enthusiast.
•    Skier.

•    Personal website:

Join to automatically receive all group messages.