[nvda-addons] Dynamically changing control IDs

  • From: David Mehler <dave.mehler@xxxxxxxxx>
  • To: nvda-addons <nvda-addons@xxxxxxxxxxxxx>
  • Date: Wed, 6 Jul 2016 01:30:26 -0400

Hello,

I'm trying to write an addon for an application, it's called demon
tools lite and it's purpose is to mount iso or other cd/dvd disk
images as virtual cd/dvd drives.

I installed this app on one of my machines, 7 at the time, since gone
to ten, and made a .py file, part below. It's going to do a few
things, first check for a button, then check if that button has a
specific control ID, if it does, speak a label so that when tabbing
through I know what each button, which by default are unlabeled, does.

The problem is I put this app on another machine, laptop that went
ten, and loaded the app module. It didn't work. Exploring the buttons
I found out why, apparently the app uses dynamically generated control
IDs for the buttons, works fine on the one box, doesn't work a t all
on the other.

Here's a snipet of code:

import appModuleHandler
from NVDAObjects.window import Window

class AppModule(appModuleHandler.AppModule):
    def event_NVDAObject_init(self, obj):
        if isinstance(obj, Window) and obj.windowClassName == "Button":
            if obj.windowControlID == 1042:
                obj.name = "Connect"
            if obj.windowControlID == 1043:
                obj.name = "Save"

Does anyone have a better way of doing this or something more reliable?

Thanks.
Dave.
----------------------------------------------------------------
NVDA add-ons: A list to discuss add-on code enhancements and for reporting 
bugs. 

Community addons are available from: http://addons.nvda-project.org
To send a message to the list: nvda-addons@xxxxxxxxxxxxx
To change your list settings/unsubscribe: 
//www.freelists.org/list/nvda-addons
To contact list moderators: nvda-addons-moderators@xxxxxxxxxxxxx

Other related posts: