aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarolyn MacLeod2013-02-26 15:24:50 (EST)
committerLakshmi Shanmugam2013-02-28 03:26:22 (EST)
commit4d8e317cea05db9b5278d6a4d298d508f6069284 (patch)
treeb6e70b5bdc777aba132a310ebb43be423edb866e
parent4af20dc54c8b5649274cf9e5a06d5ddfda625879 (diff)
downloadeclipse.platform.swt-4d8e317cea05db9b5278d6a4d298d508f6069284.zip
eclipse.platform.swt-4d8e317cea05db9b5278d6a4d298d508f6069284.tar.gz
eclipse.platform.swt-4d8e317cea05db9b5278d6a4d298d508f6069284.tar.bz2
Bug 336125 - ACC.RELATION_DESCRIBED_BY does not work for Text
-rw-r--r--examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet340.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet340.java b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet340.java
index 1294d40..3707818 100644
--- a/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet340.java
+++ b/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet340.java
@@ -33,7 +33,9 @@ public static void main(String[] args) {
shell.setLayout(new GridLayout());
shell.setText("Description Relation Example");
- final Label liveLabel = new Label(shell, SWT.BORDER);
+ // (works with either a Label or a READ_ONLY Text)
+ final Label liveLabel = new Label(shell, SWT.BORDER | SWT.READ_ONLY);
+// final Text liveLabel = new Text(shell, SWT.BORDER | SWT.READ_ONLY);
liveLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
liveLabel.setText("Live region messages go here");
@@ -60,6 +62,12 @@ public static void main(String[] args) {
}
});
textField.getAccessible().addRelation(ACC.RELATION_DESCRIBED_BY, liveLabel.getAccessible());
+ liveLabel.getAccessible().addRelation(ACC.RELATION_DESCRIPTION_FOR, textField.getAccessible());
+ textField.getAccessible().addAccessibleListener(new AccessibleAdapter() {
+ public void getDescription(AccessibleEvent event) {
+ event.result = liveLabel.getText();
+ }
+ });
shell.pack();
shell.open();