Frage

I'm using AT-SPI to inspect my application's GUI. However, some of the "check boxes" aren't real GTK check boxes, they're custom widgets. Because of this, they don't report the correct information in AT.

Does anybody know how I would go about fixing this? I'm writing in C# under Mono, using the Gtk# bindings to GTK+. I believe it's supposed to be possible to use ATK to change what gets reported to AT, but all the examples are in C, and the managed C# bindings work rather differently.

Any hints?

War es hilfreich?

Lösung

The Gtk.Widget class has an Accessible property of type Atk.Object. You can get but not set this property. You also cannot override it in a subclass. However, it appears that Atk.Object has several writable properties, and writing to them changes the information returned by AT.

For example:

var widget = new Gtk.Label("Hello World");
widget.Accessible.Role = Atk.Role.PushButton;

This creates a normal label widget, but causes AT to believe that it's actually a button widget.


I have yet to determine how to change a widget's apparent state. There are two ways it looks like this should be possible:

  • Atk.Object.NotifyStateChange(Atk.StateType, bool) looks like it might send a change signal indicating that a certain state type now has a given bool value.

  • Atk.Object.RefStateSet() returns an Atk.StateSet, on which you can call AddState(Atk.StateType) and RemoveState(Atk.StateType).

Neither of these actually has any effect on the information reported by AT. I even tried changing the state set first and firing the event afterwards... It still has absolutely no effect at all.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top