Export (0) Print
Expand All
Expand Minimize

Control.AccessibilityNotifyClients Method

Notifies the accessibility client applications of the specified AccessibleEvents for the specified child control.

[Visual Basic]
Protected Sub AccessibilityNotifyClients( _
   ByVal accEvent As AccessibleEvents, _
   ByVal childID As Integer _
)
[C#]
protected void AccessibilityNotifyClients(
 AccessibleEvents accEvent,
 int childID
);
[C++]
protected: void AccessibilityNotifyClients(
 AccessibleEvents accEvent,
 int childID
);
[JScript]
protected function AccessibilityNotifyClients(
   accEvent : AccessibleEvents,
 childID : int
);

Parameters

accEvent
The AccessibleEvents object to notify the accessibility client applications of.
childID
The child Control to notify of the accessible event.

Remarks

You must call the ControlAccessibleObject.NotifyClients method for each AccessibleEvents object the accessibility client applications are to be notified of. The NotifyClients method is typically called when a property is set or from within an event handler. For example, you might call the NotifyClients method and pass in AccessibleEvents.Hide from within the event handler for the Control.VisibleChanged event.

Example

[Visual Basic, C#, C++] The following example demonstrates the creation of an accessibility-aware chart control, using the AccessibleObject and Control.ControlAccessibleObject classes to expose accessible information. The control plots two curves along with a legend. The ChartControlAccessibleObject class, which derives from ControlAccessibleObject, is used in the CreateAccessibilityInstance method to provide custom accessible information for the chart control. Since the chart legend is not an actual Control-based control, but instead is drawn by the chart control, it does not any built-in accessible information. Because of this, the ChartControlAccessibleObject class overrides the GetChild method to return the CurveLegendAccessibleObject that represents accessible information for each part of the legend. When an accessible-aware application uses this control, the control can provide the necessary accessible information.

[Visual Basic, C#, C++] This code excerpt demonstrates calling the AccessibilityNotifyClients method. See the AccessibleObject class overview for the complete code example.

[Visual Basic] 
' Gets or sets the location for the curve legend.            
Public Property Location() As Point
    Get
        Return m_location
    End Get
    Set
        m_location = value
        chart.Invalidate()

        ' Notifies the chart of the location change. This is used for
        ' the accessibility information. AccessibleEvents.LocationChange
        ' tells the chart the reason for the notification.
        chart.ExposeAccessibilityNotifyClients(AccessibleEvents.LocationChange, _
                CType(AccessibilityObject, CurveLegendAccessibleObject).ID)
    End Set
End Property

' Gets or sets the Name for the curve legend.            
Public Property Name() As String
    Get
        Return m_name
    End Get
    Set
        If m_name <> value Then
            m_name = value
            chart.Invalidate()

            ' Notifies the chart of the name change. This is used for
            ' the accessibility information. AccessibleEvents.NameChange
            ' tells the chart the reason for the notification. 
            chart.ExposeAccessibilityNotifyClients(AccessibleEvents.NameChange, _
                    CType(AccessibilityObject, CurveLegendAccessibleObject).ID)
        End If
    End Set
End Property

' Gets or sets the Selected state for the curve legend.            
Public Property Selected() As Boolean
    Get
        Return m_selected
    End Get
    Set
        If m_selected <> value Then
            m_selected = value
            chart.Invalidate()

            ' Notifies the chart of the selection value change. This is used for
            ' the accessibility information. The AccessibleEvents value varies
            ' on whether the selection is true (AccessibleEvents.SelectionAdd) or 
            ' false (AccessibleEvents.SelectionRemove). 
            If m_selected Then
                chart.ExposeAccessibilityNotifyClients(AccessibleEvents.SelectionAdd, _
                        CType(AccessibilityObject, CurveLegendAccessibleObject).ID) 
            Else
                chart.ExposeAccessibilityNotifyClients(AccessibleEvents.SelectionRemove, _
                        CType(AccessibilityObject, CurveLegendAccessibleObject).ID) 
            End If
        End If
    End Set
End Property

[C#] 
// Gets or sets the location for the curve legend.
public Point Location
{   
    get {
        return location;
    }
    set {
        location = value;
        chart.Invalidate();

        // Notifies the chart of the location change. This is used for
        // the accessibility information. AccessibleEvents.LocationChange
        // tells the chart the reason for the notification.

        chart.AccessibilityNotifyClients(AccessibleEvents.LocationChange, 
            ((CurveLegendAccessibleObject)AccessibilityObject).ID);
    }
}            
        
// Gets or sets the Name for the curve legend.
public string Name
{   
    get {
        return name;
    }
    set {
        if (name != value) 
        {
            name = value;
            chart.Invalidate();

            // Notifies the chart of the name change. This is used for
            // the accessibility information. AccessibleEvents.NameChange
            // tells the chart the reason for the notification.

            chart.AccessibilityNotifyClients(AccessibleEvents.NameChange, 
                ((CurveLegendAccessibleObject)AccessibilityObject).ID);
        }
    }
}

// Gets or sets the Selected state for the curve legend.
public bool Selected
{   
    get {
        return selected;
    }
    set {
        if (selected != value) 
        {
            selected = value;
            chart.Invalidate();

            // Notifies the chart of the selection value change. This is used for
            // the accessibility information. The AccessibleEvents value depends upon
            // if the selection is true (AccessibleEvents.SelectionAdd) or 
            // false (AccessibleEvents.SelectionRemove).
            chart.AccessibilityNotifyClients(
                selected ? AccessibleEvents.SelectionAdd : AccessibleEvents.SelectionRemove, 
                ((CurveLegendAccessibleObject)AccessibilityObject).ID);
        }
    }
}

[C++] 
// Gets or sets the location for the curve legend.
__property Point get_Location() {
   return location;
}
__property void set_Location(Point value) {
   location = value;
   chart->Invalidate();

   // Notifies the chart of the location change. This is used for
   // the accessibility information. AccessibleEvents::LocationChange
   // tells the chart the reason for the notification.

   chart->AccessibilityNotifyClients(AccessibleEvents::LocationChange,
      (dynamic_cast<CurveLegendAccessibleObject*>(AccessibilityObject))->ID);
}

// Gets or sets the Name for the curve legend.
__property String* get_Name() {
   return name;
}
__property void set_Name(String* value) {
   if (name != value) {
      name = value;
      chart->Invalidate();

      // Notifies the chart of the name change. This is used for
      // the accessibility information. AccessibleEvents::NameChange
      // tells the chart the reason for the notification.

      chart->AccessibilityNotifyClients(AccessibleEvents::NameChange,
         (dynamic_cast<CurveLegendAccessibleObject*>(AccessibilityObject))->ID);
   }
}

// Gets or sets the Selected state for the curve legend.
__property bool get_Selected() {
   return selected;
}
__property void set_Selected(bool value) {
   if (selected != value) {
      selected = value;
      chart->Invalidate();

      // Notifies the chart of the selection value change. This is used for
      // the accessibility information. The AccessibleEvents value depends upon
      // if the selection is true (AccessibleEvents::SelectionAdd) or
      // false (AccessibleEvents::SelectionRemove).
      chart->AccessibilityNotifyClients(selected ? AccessibleEvents::SelectionAdd : AccessibleEvents::SelectionRemove,
         (dynamic_cast<CurveLegendAccessibleObject*>(AccessibilityObject))->ID);
   }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Control Class | Control Members | System.Windows.Forms Namespace | AccessibleEvents | Controls

Show:
© 2014 Microsoft