Community
Participate
Working Groups
Currently, StyledText and CCombo will look to see if a Label precedes them in the z-order (i.e. the Label must be a sibling, and it must be created immediately before the StyledText or CCombo), and if so, then the Label text can be used for the StyledText or CCombo's default accessible name.
Created attachment 174467 [details] patch for StyledText and CCombo to use CLabel as name
SSQ, please review for 3.6.1. Here is a snippet: import org.eclipse.swt.*; import org.eclipse.swt.widgets.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.custom.*; public class CLabelAccessibleNameTest { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(2, false)); CLabel clabel = new CLabel(shell, SWT.NONE); clabel.setText("CLabel for the StyledText:"); StyledText styledText = new StyledText(shell, SWT.SINGLE | SWT.BORDER); styledText.setText("Some text"); CLabel clabel2 = new CLabel(shell, SWT.NONE); clabel2.setText("CLabel for the CCombo:"); CCombo ccombo = new CCombo(shell, SWT.BORDER); ccombo.setItems(new String[] {"one", "two", "three"}); ccombo.setText(ccombo.getItem(0)); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } } }
Created attachment 175895 [details] patch Car, please try this patch out. Same idea but it avoids a couple of casts and instanceof checks. It also fixes the fact that getAssociatedLabel() would loop through all siblings when the styledtext/ccombo is the first child and still return null.
I like that much better. I'll try it out when I get back.
Works great - thanks. I'll release for 3.6.1 and 3.7.
Fixed > 20100824 in HEAD for 3.7.
Fixed > 20100824 in 3.6.1 stream.