Focus Property

[This is preliminary documentation and subject to change.]

An object's Focus property, retrieved by calling the IAccessible::get_accFocus method, allows clients to discover if a particular accessible object and/or child element has the focus.

Like many elements in Windows applications, accessible objects can be selected and receive keyboard focus. These attributes enable users to interact with application elements, changing values or otherwise manipulating them.

Note Object selection and object focus are two entirely different ideas. The "focused" object is the one object in the entire system that receives keyboard input, while the "selected" object is marked to participate in some type of group operation. Additionally, focused items can be in or out of a selection of items. For example, you can select several items in a list view control in preparation for moving or deleting them all. However, the focus is given only to one object in the system at a time.

Menus do not incorporate item selection. When a user highlights menu items, the server must not generate EVENT_OBJECT_SELECTION events or any other selection related event. Instead, the server should generate an EVENT_OBJECT_FOCUS event specific to the object that is currently highlighted. This only applies to a server creating custom menu code or a user interface that appears to the user as a menu. Active Accessibility provides support for the Win32 menu APIs. Menus created via Win32 APIs and resource files will send the correct events and expose MSAA objects.

Implementers: If the object itself has the keyboard focus, return CHILDID_SELF as a VT_I4 type. If a child is an accessible object and has the focus, return the address of its IDispatch interface (a VT_DISPATCH type). Or, if a child has the focus but isn't an accessible object, return the child ID to the child as a VT_I4 type.