Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] How does Accessible interface works ?


Hi,

I'm trying to implement accessibility on a widget I've created (from swt.Canvas).
As I can see in Eclipse 3.0 help system I implement an "org.eclipse.swt.accessibility.AccessibleControlListener" (see below),
and I do the following to setup accessible inside my widget: "getAccessible().addAccessibleControlListener( new MyAccessible() );".

My widget contains inner rectangle which are able to get the "focus" (only one can have focus at a time),
user can give the focus from a rectangle to an other using arrows keys.
To implements full accessibility, when user change the focused rectangle, I must to make the screen reader talking new data from focused rectangle,
to do this I write the following method:
private void saidFocusedEvent()
  {
     this.getAccessible().setFocus( ACC.CHILDID_SELF );//doesn't work: this.handle );
  }

I'm using two different screen reader:
1/ first is the Microsoft's Narrator:
        If this screen reader read all tooltips I open from my widget, it never said things when I call "saidFocusedEvent" method.

2/second is Windows Eyes 4.5 SP3:
        this one tell more things than Ms'Narrator, all tooltips, all "text" I draw in my Widget,
        But it said texts only for  the first 3 call of  "saidFocusedEvent()", after that all call to "saidFocusedEvent()" are quiet ... to bad !
        (sometimes it continue to read the first texts I've returned in MyAccessible.getValue() for each "saidFocusedEvent()" call ... to bad too ).
        (when it's quiet I can see none of the trace output I wrote in method like if interface's method are never called ...).

Does anyone have experimented this kind of behaviour ?

As I'm not the only one in development team who experiment this kind of things,
I want to know where I'm wrong in my source code ?

How can I make my accessible implementation talk data when I want to do it ?

Does anyone knows what I must return in Accessible.getRole() method ? None of the constants defined in ACC class suit me...
and if I return nothing ... screen reader just said "Custom control" without said text I return in getValue()... strange ?

Any help is really welcome, thanks a lot !

Arnaud.


PS: AccessibleControlListener implementation:

 private class MyAccessible implements AccessibleControlListener
  {
    public void getRole(AccessibleControlEvent e)
    {
        e.detail=ACC.ROLE_TOOLTIP; //KO:_TABLECELL;//_SCROLLBAR;//_TOOLTIP; //_LABEL; //KO:_CLIENT_AREA;
System.out.println("[TITBW] Accessible["+this.hashCode()+"].getRole()");      
    }  
    public void getValue(AccessibleControlEvent e)
    {
      e.result =getFocusedRectangleData();
System.out.println("[TIBTW] Accessible["+this.hashCode()+"].getValue() said ?=<"+s+">");      
    }
    public void getState(AccessibleControlEvent e)
    {
      e.detail=ACC.STATE_FOCUSED ;
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getState()");      
    }
    public void getFocus( AccessibleControlEvent e)
    {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getFocus()");
      e.detail = ACC.CHILDID_SELF;
    }
    public void getChildAtPoint(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getChildAtPoint()");
    }
    public void getLocation(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getLocation()");
    }
    public void getChild(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getChild()");
    }
    public void getChildCount(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getChildCount()");
    }
    public void getDefaultAction(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getDefaultAction()");
    }
    public void getSelection(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getSelection()");
       e.detail = ACC.CHILDID_SELF; //ThreadInfoByTimeWidget.this.handle;
    }
    public void getChildren(AccessibleControlEvent e) {
System.out.println("[TITBW] Accessible["+this.hashCode()+"] getChildren()");
    }
  }

Back to the top