如何为TEdit控件设置关联的Accessible Name以适配屏幕阅读器?
Accessible Text Box Announcements: Why Some Controls Say More Than Others
If you've wondered why screen readers behave differently with text boxes across applications, here's a clear breakdown:
- When using a screen reader like Microsoft Narrator with a standard text box, you'll only hear "Editing text" when focus enters the control. This is because the basic text box doesn't expose an Accessible Name to the assistive technology system.
- In accessibility-friendly apps like Microsoft File Explorer, Microsoft Word, Microsoft Excel, and Microsoft Outlook, the screen reader will announce something like "Batch separator. Editing text". This happens because these controls provide an Accessible Name (e.g., "Batch separator") that the assistive system can retrieve.
How This Works Technically
This enhanced accessibility behavior is achieved by implementing the IAccessible interface for the window. The operating system retrieves this interface by sending the WM_GETOBJECT message to the window's handle (hWnd). Once it has the IAccessible implementation, the system can access the Accessible Name and other key accessibility properties, enabling screen readers to deliver more context-rich announcements for users.
内容的提问来源于stack exchange,提问作者Ian Boyd
相关产品推荐
相关产品推荐

