Bug 10755 - List and Table behave differently when labelled with a Label
Summary: List and Table behave differently when labelled with a Label
Status: RESOLVED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Carolyn MacLeod CLA
QA Contact:
URL:
Whiteboard:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2002-03-05 08:51 EST by Tod Creasey CLA
Modified: 2002-05-13 14:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2002-03-05 08:51:41 EST
If you put a Label in the same Composite as a List and then inspect the entries 
in the List using inspect32 the List will have a name the same as label (see 
the parent entry in the inspect 32 window).

This is significant as JAWS takes the name of the parent of a selected item and 
repeats it.

If you do the same thing with a Table you will not get this behaviour.

Here is the example with the List. The List wiil have a name Title

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
/*
 * (c) Copyright 2001 MyCorporation.
 * All Rights Reserved.
 */
/**
 * @version 	1.0
 * @author
 */
public class ListLabelTest {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		
		
		Label label = new Label(shell,SWT.NONE);
		label.setText("Title");
		label.setBounds(0,0,200,20);
		
		List list = new List(shell,SWT.BORDER);
		
		list.add("item1");
		
		list.add("item2");
		
		list.add("item3");
		
		list.setBounds(0,20,200,200);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	
	}
}


here is the same example using a Table. The Table will have no label

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
/*
 * (c) Copyright 2001 MyCorporation.
 * All Rights Reserved.
 */
/**
 * @version 	1.0
 * @author
 */
public class TableLabelTest {

	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		
		
		Label label = new Label(shell,SWT.NONE);
		label.setText("Title");
		label.setBounds(0,0,200,20);
		
		Table mainTable = new Table(shell,SWT.SINGLE | SWT.BORDER | 
SWT.FULL_SELECTION);
		
		TableItem item1 = new TableItem(mainTable, SWT.NULL);
		item1.setText("item1");
		
		TableItem item2 = new TableItem(mainTable, SWT.NULL);
		item2.setText("item2");
		
		TableItem item3 = new TableItem(mainTable, SWT.NULL);
		item3.setText("item3");
		
		mainTable.setBounds(0,20,200,200);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 1 Mike Wilson CLA 2002-03-05 09:12:40 EST
CM to investigate.
Comment 2 Carolyn MacLeod CLA 2002-03-05 09:56:12 EST
Completely expected behavior. Here is a section from the MSAA SDK:

Providing the Name Property
Server developers must take care when creating predefined and common controls 
to ensure that Active Accessibility can expose the Name property for the 
control. Depending on the kind of control, the text for the Name property comes 
from one of the following: 

- The control's window text (or caption) 
- Static text that labels the control 
To find the control's window text, Active Accessibility sends the WM_GETTEXT 
message to the control. This text corresponds to the text parameter in the 
control's resource definition statement. For some controls, such as buttons, 
this is the same text that is displayed with the control. For other controls, 
such as toolbars, this text is not displayed. Therefore, server developers must 
provide meaningful text in the control's resource definition statement to help 
users of client utilities identify the control.

To find the control's label, Active Accessibility searches for a static text 
control by calling GetWindow with the GW_HWNDPREV flag. The search is halted if 
a static text control is found, or if a control is encountered that has the 
window styles WS_GROUP | WS_TABSTOP. This search order corresponds to the 
reverse tab order on a dialog box. Server developers must observe the tab order 
when creating controls so that a static text control immediately precedes the 
control that it labels.

Comment 3 Carolyn MacLeod CLA 2002-03-05 11:15:25 EST
Sorry about the previous note. Yes, this is in fact expected behavior, but not 
for the reaason I listed. The SWT List is a win32 "LISTBOX" control. The SWT 
Table is a win32 "SysListView" control. If we look at the default accessibility 
behavior for get_accName specified for each control, we see that they are 
intened to behave differently (of course, it does not say why... <g>). Here are 
the specs:

LISTBOX:
get_accName 
The Name property for the list box object is the text from a static text 
control that labels the list box. For the list box items, the Name property is 
the text of the list item. 

SysListView:
get_accName 
The Name for the list view object is obtained from the control's window text 
(or caption). This text is not displayed with the list view control, so server 
developers must provide meaningful text in the control's resource definition 
statement to help users of client utilities to identify the control. For the 
list view items, the Name property is the text of the list item. 
Comment 4 Tod Creasey CLA 2002-03-14 13:29:54 EST
Platform limitation. Can be deferred.
Comment 5 Steve Northover CLA 2002-05-13 14:48:07 EDT
Platform behavior.