[nvda-addons] Re: Dynamically changing control IDs

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

Hello Joseph,

Thank you. I will check out the TeamTalk addon for the code you speak of.

What do I do if as I'm suspecting the IDs are dynamically generated
like during program install?

Thanks.
Dave.


On 7/6/16, Joseph Lee <joseph.lee22590@xxxxxxxxx> wrote:

Hi David,
I think a slightly better way would be to have a map (dictionary) of control
ID's to label names so the object init event can pull it in (this is
employed in TeamTalk add-on and others). Note that this works best if
control ID's are static across sessions/systems/upgrades.
Cheers,
Joseph

-----Original Message-----
From: nvda-addons-bounce@xxxxxxxxxxxxx
[mailto:nvda-addons-bounce@xxxxxxxxxxxxx] On Behalf Of David Mehler
Sent: Tuesday, July 5, 2016 10:30 PM
To: nvda-addons <nvda-addons@xxxxxxxxxxxxx>
Subject: [nvda-addons] Dynamically changing control IDs

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

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

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