[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Traversing out of a Text widget.
|
Thanks Steve and Veronika,
your solution was exactly what I needed.
Best regards,
Martin Maercker
"Steve Northover" <steve_northover@xxxxxxxxxx> schrieb im Newsbeitrag
news:csjm8n$t3a$1@xxxxxxxxxxxxxxxxxx
> You should be able to modify snippet this snippet:
>
>
>
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/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@xxxxxxx> schrieb im Newsbeitrag
news:csjn5q$2ap$1@xxxxxxxxxxxxxxxxxx
> 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@xxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
news:csek2t$fer$1@xxxxxxxxxxxxxxxxxx
> 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
>
>
>
>