accessibility for a blinds users on my project

Are you writing your own components and need help with how to set them up or have questions about the components you are deriving from ? Ask them here.
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

accessibility for a blinds users on my project

Post by marco_84 »

Hello everyone I state that I am blind and I have a school-leaving certification of information tecnology,
I want to implement wxaccessible in my project,
I built the example of wxwidgets with gcc version 3.4.5 and wxwidgets version 3.0.4 on windows10 o.s.,
I use the narrator under windows10 operating system, the narrator on listbox component speak perfectly,
I would like to bring the accessibility of the listbox on my program that uses the treelist,
I try to adapt the accessibility class of the example found on wxwidgets 3.0.4 to my program,
the narrator speak the name of the window only
but when I want to listen inside the treelist the narrator is mute.
If possible, someone help me make my program accessible?
I have already consulted the manual of the wxaccessible but I don't understand it very well


thanks for all

marco_84
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

Hi and welcome to the forum.

First of all, wxAccessible is modeled closely after Microsofts MSAA, so reading about that might help you understand the concept a little better: https://en.wikipedia.org/wiki/Microsoft ... essibility

In general:
For each type of control you want to make accessible, you derive your own class from wxAccessible and you override all methods that make sense for that particular control.

I've only done that once, for a simple button, so take the following with a grain of salt:

For a listbox, you'll probably need to override quite a few of them. E.g.:
wxAccessible::GetChildCount - would return the number of items in the list
wxAccessible::GetDescription or GetName() will probably return the text that the narrator will speak
wxAccessible::GetRole should return wxROLE_SYSTEM_LISTITEM (defined in <wx\access.h> )

I don't know which are absolutely necessary to make it work, you'll have to experiment a bit.

Then, in order to activate this, you use code like this:

Code: Select all

your_control_pointer->SetAccessible( new MyControlAccessible(your_control_pointer) );
Or, if it was in the constructor of a class derived from a control:

Code: Select all

SetAccessible( new MyControlAccessible(this) );
BTW: There is another blind wxWidgets developer who is often active on the wxWidgets mailing list / user group: https://groups.google.com/forum/#!forum/wx-users

His name is Tim Burgess <[email protected]>
www.raisedbar.net

He might have more experience with wxAccessible.
Use the source, Luke!
PB
Part Of The Furniture
Part Of The Furniture
Posts: 4193
Joined: Sun Jan 03, 2010 5:45 pm

Re: accessibility for a blinds users on my project

Post by PB »

Hello!

I have no experience with accessibility but I noticed that you are using wxWidgets version 3.0.4. Accessibility support under Windows should be significantly improved in version 3.1.2 so perhaps you could try this version.

While 3.1 branch is marked "unstable", it should be safe to use, in its release announcement it is stated
It is not inherently more buggy or less stable than the "stable" releases and you're encouraged to use it, including in production.
See also here.
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Hi doublemax, thanks for the reply
I try before writing on the forum to implement the getname function and the narrator speak the name of the window without another word
below the getname function code:

Code: Select all

// Gets the name of the specified object.
wxAccStatus PanelWindowAccessible::GetName(int childId, wxString* name)
{
    if (childId == wxACC_SELF)
    {
        * name = wxT("Elenco delle letture e dei contatori inseriti");
        return wxACC_OK;
    }
    wxPanel * splitter = wxDynamicCast(GetWindow(), wxPanel);
    if (splitter)
    {
//        if (splitter->IsSplit())
        {
            // Two windows, and the sash.
            if (childId == 1 || childId == 3)
                return wxACC_NOT_IMPLEMENTED;
            else if (childId == 2)
            {
                *name = wxT("Sash");
                return wxACC_OK;
            }
        }
    }
    // Let the framework handle the other cases.
    return wxACC_NOT_IMPLEMENTED;
}

// Can return either a child object, or an integer
// representing the child element, starting from 1.

I need to implement something that makes speak the narrator at the internal of treelist the item names but I don't understand what's missing



Hi PB
I update to the next version of the wxwidgets when I learn well the instructions of the wxapi
now I practice with this version
thanks

marco_84
Last edited by marco_84 on Tue Jul 09, 2019 9:34 pm, edited 1 time in total.
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

I would guess you need to implement a wxAccessible specific for the treelist, but i'm not sure. I'd have to experiment with this myself, but i probably won't have time for that before the weekend.
Use the source, Luke!
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Thank you very much

marco_84
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

While i managed to get a custom wxAccessiblity for a wxListbox to work, i failed to do so for a wxTreeCtrl. The main problem was that "GetChildCount" never got called and therefore the system never requested the information for the tree items.

I ran out of time and currently can't spend any more time on this, sorry.
Use the source, Luke!
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

hello doublemax thanks for help,
I have to study how to intercept the call of items to the narrator of windows10 o.s. and make an implementation on wxaccessible,
thanks anyway, I don't know to do this easy
can you help me do this?
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

This is a minimal sample using a custom wxAccessible for wxListBox. Maybe this helps.
Attachments
minimal.cpp
(11.47 KiB) Downloaded 208 times
Use the source, Luke!
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Hello,

I tested a cast on the minimal.cpp project posted below.

This is the code:

Code: Select all

#if wxUSE_ACCESSIBILITY
class MyListBoxAccessible : public wxWindowAccessible
{
public:
  MyListBoxAccessible( wxTreeListCtrl *listbox )
    : wxWindowAccessible(listbox)
  {
    _listbox = (wxListBox *)listbox;
    _listbox->SetName("my custom listbox");
  }
  ~MyListBoxAccessible() {};

...
The example project doesn't display the treelist, I posted for resolve this problem at:

problem with treelist on windows o.s.


so I try to bring the class on my project, I see that it doesn't read the cast and the windows10 narrator doesn't talk for nothing.

when I compiled, this it doesn't return an error

I do other tests and if sucessfully I will send the source file.


bye

marco_84
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

You can't just cast a wxTreeListCtrl to a wxListBox. The example i posted was just meant as a starting point for writing your own wxWindowAccessible for a wxTreeListCtrl.

BTW: I tested the example i posted with Windows 10 narrator and it did what i expected.
Use the source, Luke!
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Hi doublemax
You can't just cast a wxTreeListCtrl to a wxListBox. The example i posted was just meant as a starting point for writing your own wxWindowAccessible for a wxTreeListCtrl.

Yes,

That's what I will do,

I did a little test,

as soon as I can implementing everything with treelist

Thanks for your help

marco_84
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Hi Doublemax, I have a problem...
I changed the minimal file that you attached, but it doesn't load the functions of the class accessible, I tested the debug of the program and it ignored the functions, the setaccessible command calls correctly, but all the other sub-functions in the class are not called. I attach the file modified so you can analyze it better.
I don't know what command is missing to recall them, in the file that you posted work all correctly and it called all the functions

I'm sorry if wasting your time

thanks

marco_84
Attachments
treelistaccessible.cpp
(12.54 KiB) Downloaded 197 times
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: accessibility for a blinds users on my project

Post by doublemax »

When i run your code, i see the "GetName" and "GetRole" methods getting called. But only with childId=0. That's one of the things i got stuck with when i experimented with this. But i didn't have time to dig deeper into this.

Regardless of that, there is one issue with your code:

Code: Select all

wxTreeListItem treelistitem[5];
This is a local variable any you're passing its pointer to MyTreeListAccessible and stored there. This pointer will get invalid as soon as the array gets destroy.

I don't think it's a good idea to pass an additional list of items to the accessible anyway. It should get its information directly from the control.
Use the source, Luke!
User avatar
marco_84
Experienced Solver
Experienced Solver
Posts: 71
Joined: Mon Jul 08, 2019 7:30 pm
Location: Italy, Tuscany

Re: accessibility for a blinds users on my project

Post by marco_84 »

Hi

I made this system because it missing the getcount in the treelist, I have inserted something to replace it


marco_84
I'm using: Ubuntu and Windows platform with wxwidgets 3.1.4
Post Reply