Recent

Author Topic: TMainMenu accessibiity  (Read 14572 times)

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: TMainMenu accessibiity
« Reply #15 on: August 16, 2014, 04:56:18 pm »
(@engkin: Thanks)


Final part of the menu troubles: mnemonics

Additionally to the bug concerning the dwTypedata field in TWin32WSMenuItem.AttachMenu, there is also a problem with the fMask field.

MIIM_TYPE is used currently in the code (to retrieve or set the fType and dwTypeData fields). Unfortunately this option value is only valid for the versions of Windows anterior to Windows 98. For Windows 98 and later, MIIM_BITMAP, MIIM_FTYPE, and MIIM_STRING must be used instead (see http://msdn.microsoft.com/en-us/library/windows/desktop/ms647578%28v=vs.85%29.aspx ).

Consequently, setting the caption of the menuitem is not working for Windows 98 and later (i.e. MIIM_TYPE is REALLY not supported in these cases). It's probably related to the size of the MENUITEMINFO structure: when the Windows 95 size is used (44 bytes) MIIM_TYPE is accepted, but when Windows 98+ size is used (48 bytes, hbmpItem added), MIIM_BITMAP, MIIM_FTYPE, and MIIM_STRING must be used instead.

After a few tests, replacing MIIM_TYPE by MIIM_FTYPE or by (MIIM_FTYPE or MIIM_STRING), depending of the type of the call is working properly (i.e. the screen reader indicates the mmemonics).

Using different parameters for Windows95 or Windows98+ versions is not really a problem, as there is already one variable (i.e. menuiteminfosize) which is set depending of the Windows version in the current code.


As a conclusion, troubles and fixes:

1/ Accelerators:
-UpdateCaption method must be modified to add the accelerator(s) if present into the menu caption (using the existing MenuItemShortCut function),
-plus (unless I'm wrong), the "whole" caption (i.e. caption + eventual accelerator text) must be converted (UTF8ToUTF16 and Utf8ToAnsi), and conditional code must be used (using as usual WindowsUnicodeSupport, UnicodeEnabledOS for GetMenuItemInfoA / GetMenuItemInfoW and SetMenuItemInfoA / SetMenuItemInfoW).

2/ Mnemonics:
-bug fix for the caption into the AttachMenu method (i.e. wrong instruction dwTypeData := PChar(AMenuItem)),
-using MIIM_FTYPE or (MIIM_FTYPE or MIIM_STRING), instead of MIIM_TYPE for Windows98+,
-plus (unless I'm wrong), utf8 to ansi/widechar conversions and usual conditional code (InsertMenuItemA, InsertMenuItemW).

Walmir

  • New Member
  • *
  • Posts: 39
Re: TMainMenu accessibiity
« Reply #16 on: August 18, 2014, 06:25:49 pm »
ChrisF,
Your descoveries are very interesting.
I think all you exposed is in fact bugs. Ironnically, they are better "seen" by people who don't see well...
Maybe the fact that textual objects are beeing painted seem the root to all other "misbehavior" of Lazarus applications, wich don't have Hints, captions of TSpeedButtons, ToolbarButtons and BitButton read. For BitButtons, all is heard is "button", not the captions.

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: TMainMenu accessibiity
« Reply #17 on: August 18, 2014, 07:57:00 pm »
I think all you exposed is in fact bugs.

IMHO, yes there are certainly bugs. I intend to introduce a bug report with patches for them after the summer holidays, though I don't know if and when they'll be accepted.


Ironnically, they are better "seen" by people who don't see well...

Well, in this particular case I should even say they are "seeing" the "invisible things".


Maybe the fact that textual objects are beeing painted seem the root to all other "misbehavior" of Lazarus applications, wich don't have Hints, captions of TSpeedButtons, ToolbarButtons and BitButton read. For BitButtons, all is heard is "button", not the captions.

Yes, I think that all kinds of text which are "painted" using the graphical APIs of Windows are potentially (probably ?) a problem, considering the screen reader issues.

BTW, there has been a discussion recently concerning BitButtons and accessibility (I just discovered it a couple of days ago):
- http://lists.lazarus.freepascal.org/pipermail/lazarus/2014-June/087766.html
- or http://free-pascal-lazarus.989080.n3.nabble.com/Lazarus-Accessibility-of-Lazarus-td4037734.html 

This discussion is also related to 2 bug reports concerning this subject:
- http://bugs.freepascal.org/view.php?id=24135
- http://bugs.freepascal.org/view.php?id=24583

Apparently, the problem is currently not solved (and seems not easy to be solved simply).
« Last Edit: August 18, 2014, 07:59:52 pm by ChrisF »

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: TMainMenu accessibiity
« Reply #18 on: October 04, 2014, 12:59:30 pm »
Patch accepted (though I don't know for which release version it will be included).

See bug report: http://bugs.freepascal.org/view.php?id=26718

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4719
  • I like bugs.
Re: TMainMenu accessibiity
« Reply #19 on: October 04, 2014, 02:18:10 pm »
It will be in the next major 1.4 release. Please test with trunk as much as possible.
I am not an expert in WinAPI nor in accessibility. I applied it to ensure it will not be ignored like some patches have been for too long unfortunately.

BTW, I can recommend Lazarus trunk. It is stable and offers many goodies compared to 1.2.x.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

ChrisF

  • Hero Member
  • *****
  • Posts: 542
Re: TMainMenu accessibiity
« Reply #20 on: October 04, 2014, 03:01:50 pm »
...I am not an expert in WinAPI nor in accessibility...

I'm certainly not an expert neither in accessibility. But my feeling is that if we wait for a "real" one, we may have to wait for a very long time (I guess there are only few of them).

Anyway, thanks for including it in the next major release.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4719
  • I like bugs.
Re: TMainMenu accessibiity
« Reply #21 on: October 04, 2014, 07:16:27 pm »
I'm certainly not an expert neither in accessibility. But my feeling is that if we wait for a "real" one, we may have to wait for a very long time (I guess there are only few of them).

True. I will look at and commit any functional patch for the related TBitBtn accessibility issue, if somebody finds out how to implement it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1285
Re: TMainMenu accessibiity
« Reply #22 on: October 04, 2014, 09:04:31 pm »
BTW, I can recommend Lazarus trunk. It is stable and offers many goodies compared to 1.2.x.

Is it time for releasing a beta?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4719
  • I like bugs.
Re: TMainMenu accessibiity
« Reply #23 on: October 04, 2014, 11:31:15 pm »
Is it time for releasing a beta?

No. The 1.4 is not even branched yet. But as I said trunk is very good. Use it to get the latest features. I use it every day without problems.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018