How to use eventHandler.requestEvents


falkogiepmans@...
 

Hi all,

Currently I am working on a appModule for SAP, this has its own API and internal events. I would like NVDA to be able to listen to some of those events. One of these events is "FocusChanged", since NVDA does not notice this in SAP. My idea was to use requestEvents as follows:

Example Code
class AppModule(appModuleHandler.AppModule):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        eventHandler.requestEvents("FocusChanged", processId=self.processID,windowClassName='someWindow')
End Example Code

And use this event in some overlayclass:

Example Code
class SAPClass(IAccessible):
    def event_FocusChanged(self):
        ...do something...
End Example Code

This does not seem to work. Is this what eventHandler.requestEvents is meant for or am I understanding it wrong? I am quite new to events in general but I want to get my head around it.
Side question: Is this the place to post these kind of questions?

Thanks in advance,
Falko
 
 


 

On Wed, Apr 14, 2021 at 08:17 AM, <falkogiepmans@...> wrote:
Is this the place to post these kind of questions?
-
Not really.  The focus here is on how to use NVDA as an end user, not as a developer.

There is actually an NVDA Screen Reader Development Group where this sort of "under the hood" discussion is more suited.  Note well that it is NOT a general user support list (which the NVDA Group is), but is focused on those doing coding:
--

Brian - Windows 10 Pro, 64-Bit, Version 20H2, Build 19042  

Always remember others may hate you but those who hate you don't win unless you hate them.  And then you destroy yourself.

       ~ Richard M. Nixon

 


 

Hi,

Where did you see “focusChanged” event defined in NVDA? I can’t see that event defined in my copy of NVDA screen reader source code at the moment.

To answer the original question at hand: without going into details (something reserved for NVDA Add-ons list), eventHandler.requestEvents function is designed to let app modules respond to app events in the background. This is useful if you need to let NvDA monitor changes to an app control from everywhere. For example, an app might raise name change event in an app, and you may wish to let NVDA announce changes to this control from everywhere. A practical example in use is StationPlaylist add-on where NVDA is told to monitor for changes in status bar texts from everywhere.

Cheers,

Joseph

From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of falkogiepmans@...
Sent: Wednesday, April 14, 2021 5:17 AM
To: nvda@nvda.groups.io
Subject: [nvda] How to use eventHandler.requestEvents

 

Hi all,

Currently I am working on a appModule for SAP, this has its own API and internal events. I would like NVDA to be able to listen to some of those events. One of these events is "FocusChanged", since NVDA does not notice this in SAP. My idea was to use requestEvents as follows:

Example Code
class AppModule(appModuleHandler.AppModule):
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        eventHandler.requestEvents("FocusChanged", processId=self.processID,windowClassName='someWindow')
End Example Code

And use this event in some overlayclass:

Example Code
class SAPClass(IAccessible):
    def event_FocusChanged(self):
        ...do something...
End Example Code

This does not seem to work. Is this what eventHandler.requestEvents is meant for or am I understanding it wrong? I am quite new to events in general but I want to get my head around it.
Side question: Is this the place to post these kind of questions?

Thanks in advance,
Falko

 

 


 

Hi,

I think a more appropriate list would be NVDA Add-ons list:

https://nvda-addons.groups.io/g/nvda-addons

The add-ons list does discuss coding but is geared towards add-on authoring, which I think is the intent behind the question.

Cheers,

Joseph

 

From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of Brian Vogel
Sent: Wednesday, April 14, 2021 8:24 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] How to use eventHandler.requestEvents

 

On Wed, Apr 14, 2021 at 08:17 AM, <falkogiepmans@...> wrote:

Is this the place to post these kind of questions?

-
Not really.  The focus here is on how to use NVDA as an end user, not as a developer.

There is actually an NVDA Screen Reader Development Group where this sort of "under the hood" discussion is more suited.  Note well that it is NOT a general user support list (which the NVDA Group is), but is focused on those doing coding:

--

Brian - Windows 10 Pro, 64-Bit, Version 20H2, Build 19042  

Always remember others may hate you but those who hate you don't win unless you hate them.  And then you destroy yourself.

       ~ Richard M. Nixon

 


 

On Wed, Apr 14, 2021 at 11:38 AM, Joseph Lee wrote:
The add-ons list does discuss coding but is geared towards add-on authoring, which I think is the intent behind the question.
-
And you'd be far better at reading between the lines for the intent behind this question than I am.  Thanks for that additional pointer.  I'm never quite sure which of the development focused groups is best to direct someone to, and I try to avoid doing so unless the question is clearly development related.
 
--

Brian - Windows 10 Pro, 64-Bit, Version 20H2, Build 19042  

Always remember others may hate you but those who hate you don't win unless you hate them.  And then you destroy yourself.

       ~ Richard M. Nixon

 


 

Hi,

I think one way to distinguish between these two would be the scope of the question:

  • Add-ons list is there for add-on authors to congregate and talk about add-on writing.
  • If the question is about NVDA Core (screen reader) development itself, then it might be better suited on the development list.

There is some overlap, but I think the above criteria is one way of distinguishing between the two.

Cheers,

Joseph

 

 

 

From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of Brian Vogel
Sent: Wednesday, April 14, 2021 8:42 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] How to use eventHandler.requestEvents

 

On Wed, Apr 14, 2021 at 11:38 AM, Joseph Lee wrote:

The add-ons list does discuss coding but is geared towards add-on authoring, which I think is the intent behind the question.

-
And you'd be far better at reading between the lines for the intent behind this question than I am.  Thanks for that additional pointer.  I'm never quite sure which of the development focused groups is best to direct someone to, and I try to avoid doing so unless the question is clearly development related.
 
--

Brian - Windows 10 Pro, 64-Bit, Version 20H2, Build 19042  

Always remember others may hate you but those who hate you don't win unless you hate them.  And then you destroy yourself.

       ~ Richard M. Nixon

 


falkogiepmans@...
 

Thanks Brian and Joseph! I think both groups are interesting to look around in.
 
 


falkogiepmans@...
 

"focusChanged" is an SAP event, not a NVDA event. I want NVDA to be able to listen to this SAP event and handle it the same way as NVDA handles it own events.
I think I misunderstand not only requestEvents but also some other event related stuff in NVDA, so I'll check your suggested example and lurk around in the suggested groups to figure out what I actually want.
 
 


 

Hi,

I see. Do you know if this event is mapped to an existing NvDA event? One way to find out is running AccEvent, part of Windows SDK tools. If not, it will involve some runtime under the hood changes to let NvDA recognize this event (not sure how to do this for Microsoft Active Accessibility, but it’s a bit involved in UI Automation; based on Windows 10 App Essentials add-on source code in front of me, it involves runtime manipulation of UIA events map; at least that’s the high-level overview, so let’s discuss this on a different list).

Cheers,

Joseph

 

From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of falkogiepmans@...
Sent: Wednesday, April 14, 2021 9:11 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] How to use eventHandler.requestEvents

 

"focusChanged" is an SAP event, not a NVDA event. I want NVDA to be able to listen to this SAP event and handle it the same way as NVDA handles it own events.
I think I misunderstand not only requestEvents but also some other event related stuff in NVDA, so I'll check your suggested example and lurk around in the suggested groups to figure out what I actually want.