Recent

Author Topic: Forcing Screen reader to read TStaticText before a TDBEdit  (Read 6214 times)

Walmir

  • New Member
  • *
  • Posts: 39
Forcing Screen reader to read TStaticText before a TDBEdit
« on: August 28, 2014, 03:49:49 pm »
Hi,
I have TStaticText+TDBEdit pairs in a form and want to force the NVDA screen reader to read the TStaticText caption when the focus enters the TDBEdit.
Someone knows how can I do that?
I tried to copy the TStaticText caption to the hint of the TDBEdit, but the Lazarus applications hints are not read by the screen reader - IMO a bug.

Lazarus 1.2.4
Windows 7
NVDA screen reader
« Last Edit: August 28, 2014, 03:56:16 pm by Walmir »

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #1 on: August 29, 2014, 02:33:49 pm »
Sorry, I don't have any answer for your question (though I doubt there is a simple solution).

I wouldn't say that the fact that Hints are not read by screen readers is a bug. It's more than that: AFAIK, currently Lazarus doesn't have any accessibility features really implemented (but I could be wrong).

It seems however that the work has been started, but is currently "paused". The general architecture, definitions, classes, etc. have already been defined and implemented.

See: http://wiki.freepascal.org/LCL_Accessibility


I'm just a bit curious... Do you know if Delphi has implemented any accessibility feature into the VCL recently ?

With the old versions of Delphi that I know, it wasn't the case (for instance, Hints are not recognized neither by screen readers).

I know they have announced the support for accessibility with their FireMonkey interface with Delphi XE6 (see: http://docwiki.embarcadero.com/RADStudio/XE6/en/FireMonkey_Accessibility_Package ),  but I've seen nothing concerning the VCL.

Walmir

  • New Member
  • *
  • Posts: 39
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #2 on: August 29, 2014, 02:56:20 pm »
Unfortunately I don't have access to the newer versions of Delphi.
The last version of Delphi that I have access is 6 -- quite old, but I develop some DB applications with it until some ears ago and now I'm porting them to Lazarus.
The accessibility was not an issue at that time...
I think that if hints could be modified in some way so they could be read by the screen reader, both Lazarus and its applications would be far more accessible.

Walmir

  • New Member
  • *
  • Posts: 39
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #3 on: September 11, 2014, 03:38:35 pm »
Maybe a solutionh would be to turn on the TabStop property of all TStaticText objects.
But this behavior will annoy both kinds of users since they will need to make two TAB keustrokes instead of one to navigate from one Edit to another.
To automate this, as soon as the TStaticText object gets the focus, the application could place the focus on the object indicated in the TStaticText FocusControl. Any ideas on how to do this?

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #4 on: September 11, 2014, 07:50:04 pm »
I'm not sure it'll solve your problem, if you change automatically the focus for the StaticText controls. Because, as they won't receive the focus, the screen readers won't "see" them.

Attached a test program (see Test-FocusChange.zip) for a illustration, with 2 couples of StaticText/DBEdit controls: as soon as a StaticText control gets the focus, it sets it back to it's "associated" DBEdit control.

I don't know if and how it's possible to change the focus when entering in a StaticText control directly with the LCL. That's why I've used a Windows "hack" to do it instead.

Anyhow, NVDA (for instance) doesn't "see" the text of the StaticText controls when you are tabulating.


However, I've begun to look recently at the LCL to see how MSAA (i.e. Microsoft Active Accessibility) could be implemented in the LCL.

As a proof of concept, I've coded a "module tool" unit in order to not modify the LCL directly, just to make some tests.

As already indicated a few posts above, a first step for accessibility has already been implemented in the LCL. For instance, all TControl (and their descendants) have 3 major public accessible properties:
-AccessibleRole: to indicate push button, edit box, standard text, ...
-AccessibleValue: content for an edit text, a progress bar, ...
-AccessibleDescription: a comprehensive text for the corresponding control; like 'This button will terminate the application' for a push button that closes the program.

That's why I've tried to see how the existing "interesting" properties of the most common controls and these major public accessible properties could be mixed to give an final acceptable result. By "interesting" properties, I mean mainly:
-caption,
-hint,
-text (for edit or memo).

My main idea is:
-if Accessiblexxxx properties are filled, they are used in priority for the screen readers,
-if not, gets directly the necessary data for the screen readers from the standard control properties (i.e. those I've called above the "interesting" properties).

This way, even for applications that have not been designed specifically with accessibility on purpose, most of the data visible on the screen (included hints) could be available to the screen readers.

Unfortunately, it's still not terminated, but attached you can find a test program (see Test-WAccessibilityTmp.zip) with also a few StaticText and DBEdit controls for an illustration. DBEdit controls are not really "directly recognized" by my tool, but in fact it's absolutely not necessary to give extra informations about them to screen readers.

For instance, this sample illustrates 3 possible ways of giving extra pieces of information to the screen readers for the DBEdit controls:

-StaticText1 and DBEdit1: here, only DBEdit1 has a Hint property; this one will be read by the screen readers (so Static Text1 is not used),

-DBEdit2: similar to the DBEdit1, except that the AccessibleDescription property is used instead. DBEdit2 has both a Hint and an AccessibleDescription (see FormCreate for the AccessibleDescription value), but AccessibleDescription is used for screen readers instead of Hint,

-StaticText3 and DBEdit3: StaticText3 has an accelerator (Alt+S), and DBEdit3 is defined as its FocusControl property. So, the StaticText3 Caption and Hint are "associated" by my tool to DBEdit3; and they are automatically sent to the screen readers when you're entering DBEdit3.


I intend to write a small documentation to use my tool, but as I've written before it's not over yet, and so there is currently none.

But if you are interested at least for making some tests, I can make quickly a brief one. Anyway, using it is very simple and doesn't necessitate a lot of additional code; generally only 2 conditional instructions to add.

Even if you don't plan to use it, I'd be still very interested to get some feedbacks in the future (when it'll be finished of course). Because it's main purpose is to be a sort of a "draft" for my proposal of a future implementation of MSAA into the LCL.
« Last Edit: September 11, 2014, 07:55:09 pm by ChrisF »

Walmir

  • New Member
  • *
  • Posts: 39
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #5 on: September 12, 2014, 03:01:57 pm »
ChrisF,

Great! I have no words to thank you!
I hope this will be soon incorporated to Lazarus.
For my part, I am incorporating your code to my applications right now!
Thank you very much!

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #6 on: September 12, 2014, 06:29:33 pm »
Thanks. I'm very glad you find it useful.

However, I really urge you not to use the current version(s) of this module, at least for release purposes. You can of course make some tests and prepare all your pieces of information for your controls. But honestly, the current version(s) are pretty close to an alpha version; or at least a beta version with some known issues. Plus a lack of support for several basic controls : mainly "composite controls" like listbox, combobox and grid.

Attached, a more general basic sample program, a very brief documentation (Readme.txt file), and an updated version of the module itself (which fixes at least 4 general issues).


Concerning the LCL (Windows widgeset), I'm afraid it'll take a few time before I can propose a whole valid solution.

First, I must finished and debugged this module. Currently (at least):
 - one annoying issue with NVDA,
 - lack of support or incorrect support for several basic controls.

Then, I guess I should ask to the LCL team how I could integrate my solution (if they accept so). There a few technical details to discuss first, before starting to code the necessary patches.

Well, it's just a matter of time ...

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: Forcing Screen reader to read TStaticText before a TDBEdit
« Reply #7 on: May 20, 2015, 05:13:45 pm »
An updated version of WAccessibilityTmp: version beta 0.5.2. Please note that it's still currently in a unfinished state.

Known issues:
- work in progress for controls with sub-items (Listview,
  Grid, ...). Don't use WAccessibilityTmp for them with
  this version.
- issue with NVDA when application is closed.

Note: Just for clarification purposes, WAccessibilityTmp is now released with a license: a modified LGPL license, exactly the same as for the Lazarus LCL. If it's a problem, or if another kind of license is necessary please contact me (i.e. I can release it under any kind of license).

 

TinyPortal © 2005-2018