Search code examples
c#.netwinformsnarrator

Microsoft Window Narrator reads the name of controls in right to left or bottom to top


I have developed one winform application. Now I need to support narrator as well. Narrator announce control name right to left.ex. I have 3 button on form button1, button2, button3. Narrator reads as Form contains button3, button2, button1.

Again, in one another form, I set of textboxes one by one, in a stacked manner. It reads textbox names from bottom to top.

Please let me know how to customize narrator behaviour.


Solution

  • Narrator accesses your app's programmatic interface through the UI Automation API. Depending on how your UI's defined, that programmatic interface may not necessarily match the visuals shown in the app. In the case of your app, take a look at the code where the buttons are being added to the form. For example, maybe in your InitializeComponent(), you have something like this...

            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
    

    This means in the programmatic interface being exposed, button3 is the first button, and button1 is the last button, regardless of where they appear visually in the app. The Inspect tool that comes with the Windows SDK can show you the programmatic interface, and the order in which the buttons are being exposed.

    If you do see the buttons being added to the form in the order above, trying rearranging the code, to be...

            this.Controls.Add(this.button1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button3);
    

    Narrator will then announce the buttons in the order you expect.

    Thanks,

    Guy