How do I set an accessible name on an unlabeled control?

Raymond Chen

A customer asked for advice on accessibility. This was great news, because it meant that somebody actually cared about accessibility!

We have a property sheet page that contains an unlabeled list view. The list view is not labeled because its meaning is implied by its placement on the dialog. This works great as long as you can see the screen, but we also need to associate an accessible name to the list view so that screen readers know what it is. We tried Set­Window­Text on the list view, but accessibility didn’t pick it up. How do I set the accessibility name on the control?

Place a static control immediately ahead of the list view in the z-order. If you don’t want the static control to be visible, mark it as NOT WS_VISIBLE in the dialog template.

This is another manifestation of the trick we learned some time ago of using a hidden static control with an accelerator in order to associate the accelerator key with an unlabeled control. In this case, the hidden static control isn’t there to provide an accelerator; it’s there to provide an accessible name.

0 comments

Discussion is closed.

Feedback usabilla icon