Traversing out of a Text widget. [message #448954] |
Sun, 16 January 2005 20:52 |
Eclipse User |
|
|
|
Originally posted by: mmaercker.tripper-bullet.com
Hi,
What flags do I need to set or which events do I need to catch to use the
TAB key as a traversal impulse in the context of a Text widget?
I have a series of Text widgets in a window one below the other. When
SHIFT+TAB is pressed, the focus jumps from a Text widget to the one above
it. I would like a traversal in the opposite direction to take place when
the TAB tree is pressed alone (i.e. the standard traversal behaviour). I
can't stop the Text widget from interpreting the TAB key as a tab stop,
though. I've tried catching the key with a listener and then setting doit to
false which does keep a tab from being inserted but it does not lead to a
traversal event.
Any help greatly appreciated,
Martin Maerker
|
|
|
|
|
Re: Traversing out of a Text widget. [message #449212 is a reply to message #448954] |
Wed, 19 January 2005 15:33 |
Eclipse User |
|
|
|
Originally posted by: mmaercker.tripper-bullet.com
Thanks Steve and Veronika,
your solution was exactly what I needed.
Best regards,
Martin Maercker
"Steve Northover" <steve_northover@ca.ibm.com> schrieb im Newsbeitrag
news:csjm8n$t3a$1@www.eclipse.org...
> You should be able to modify snippet this snippet:
>
>
>
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.sni ppets/src/org/ec
lipse/swt/snippets/Snippet127.java?rev=HEAD&content-type =text/vnd.viewcvs-ma
rkup
>
> by setting "doit=true" for the traverse next case. This will cause
> traversal to happen rather than the tab character to be inserted into the
> control. NOTE: This should not be necessary if the widgets are
single-line
> text controls. If the widgets are multi-line, you might frustrate your
> users because they will expect to be able to insert tab characters.
"Veronika Irvine" <veronika_irvine@oti.com> schrieb im Newsbeitrag
news:csjn5q$2ap$1@www.eclipse.org...
> Use a traverse listener:
>
> public static void main (String [] args) {
> final Display display = new Display ();
> Shell shell = new Shell (display);
> shell.setLayout(new FillLayout());
> Text t = new Text(shell, SWT.MULTI | SWT.WRAP);
> t.setText("asd a sda da d ad as da sd adadadsasd");
> t.addTraverseListener(new TraverseListener() {
> public void keyTraversed(TraverseEvent e) {
> if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail
==
> SWT.TRAVERSE_TAB_PREVIOUS) {
> e.doit = true;
> }
> }
> });
> Button b = new Button(shell, SWT.PUSH);
> b.setText("Button");
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
"Martin Maercker" <mmaercker@tripper-bullet.com> schrieb im Newsbeitrag
news:csek2t$fer$1@www.eclipse.org...
> Hi,
>
> What flags do I need to set or which events do I need to catch to use the
> TAB key as a traversal impulse in the context of a Text widget?
>
> I have a series of Text widgets in a window one below the other. When
> SHIFT+TAB is pressed, the focus jumps from a Text widget to the one above
> it. I would like a traversal in the opposite direction to take place when
> the TAB tree is pressed alone (i.e. the standard traversal behaviour). I
> can't stop the Text widget from interpreting the TAB key as a tab stop,
> though. I've tried catching the key with a listener and then setting doit
to
> false which does keep a tab from being inserted but it does not lead to a
> traversal event.
>
>
> Any help greatly appreciated,
>
> Martin Maerker
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03073 seconds