Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Selecting text in multiple Text widgets simultaneously with SWT.MULTI style - can I stop this?
Selecting text in multiple Text widgets simultaneously with SWT.MULTI style - can I stop this? [message #494772] Mon, 02 November 2009 10:36 Go to next message
Eclipse UserFriend
I've added several Text widgets to a Composite, each Text widget has the SWT.MULTI style.
On Windows, as well as allowing the Text to span multiple lines, and for selection to span multiple lines, it also allows you to select text in multiple Text widgets simultaneously. However, only the last selection is copied.For comparison, Linux/GTK only permits a selection in one Text.

See attached for example.

Does anyone know if this behavior is by design, and in any case how to work around it?
Re: Selecting text in multiple Text widgets simultaneously with SWT.MULTI style - can I stop this? [message #494773 is a reply to message #494772] Mon, 02 November 2009 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Fine.... don't let me attach this then Sad
---------------------------

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

/**
* Interactive test to demonstrate multiply selected text boxes.
*/
public class MultipleSelectedTextBoxes {

public static void main(final String[] args) {
final Shell shell = new Shell();
shell.setSize(100, 300);
shell.setLayout(new RowLayout(SWT.VERTICAL));
new Text(shell, SWT.MULTI).setText("selectMe\nselectMe");
new Text(shell, SWT.MULTI).setText("selectMeToo\nselectMeToo");

shell.layout();
shell.open();

final Display d = shell.getDisplay();
while (!d.isDisposed()) {
if (!d.readAndDispatch()) {
d.sleep();
}
}
}

}

[Updated on: Mon, 02 November 2009 10:41] by Moderator

Re: Selecting text in multiple Text widgets simultaneously with SWT.MULTI style - can I stop this? [message #495072 is a reply to message #494772] Tue, 03 November 2009 12:17 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

This is logged as https://bugs.eclipse.org/bugs/show_bug.cgi?id=216666 .
Reading the report, it's believed that this is native behaviour, but there
aren't other native apps sited to prove/disprove this. If you're able to
find a native app that demonstrates that this behaviour is wrong then please
add a comment to the report with it, and it may serve as a catalyst for
investigating this further.

The only workaround I can think of is to add focus in/out listeners to the
Texts and clear/set the selection when needed.

Grant


"Tim Moore" <tmm-bugs.eclipse@decisionsoft.co.uk> wrote in message
news:hcmu95$emb$1@build.eclipse.org...
> I've added several Text widgets to a Composite, each Text widget has the
SWT.MULTI style.
> On Windows, as well as allowing the Text to span multiple lines, and for
selection to span multiple lines, it also allows you to select text in
multiple Text widgets simultaneously. However, only the last selection is
copied.For comparison, Linux/GTK only permits a selection in one Text.
>
> See attached for example.
>
> Does anyone know if this behavior is by design, and in any case how to
work around it?
Re: Selecting text in multiple Text widgets simultaneously with SWT.MULTI style - can I stop this? [message #495226 is a reply to message #495072] Wed, 04 November 2009 04:32 Go to previous message
Eclipse UserFriend
Thanks for the reply. It might have to be the focus listeners as you suggest.
If I find a native app I'll add a reply to the bug.
Previous Topic:SWT EVENTS CAPTURING IN LINUX
Next Topic:Button loses selection event after disabled it
Goto Forum:
  


Current Time: Tue Jul 01 23:28:52 EDT 2025

Powered by FUDForum. Page generated in 0.25773 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top