Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Text Widget spaces the TAB
Text Widget spaces the TAB [message #898986] Mon, 30 July 2012 02:32 Go to next message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 106
Registered: July 2009
Location: korea
Senior Member

Pressing TAB to move to the next widget without having to go I'd like to put a space in text.

Why did not work?
show you my code.
thanks.

public class TextWidgetText implements IEntryPoint {
	private Text text_1;

	/**
	 * @wbp.parser.entryPoint
	 */
	public int createUI() { 
		final Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());
		int style = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
		
		final Text text = new Text(shell, style);
		text.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				System.out.println(e.keyCode);
				
				if(e.stateMask == 0 && e.keyCode == SWT.TAB) {
					text.insert(new Character(SWT.TAB).toString());
				}
			}
		});
		text.addTraverseListener(new TraverseListener() {
			public void keyTraversed(TraverseEvent e) {
				if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
					e.doit = false;
					e.detail = SWT.TRAVERSE_NONE;
				}
			}
		});
		
		text_1 = new Text(shell, SWT.BORDER);
		text_1.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
			
				if(e.stateMask == 0 && e.keyCode == SWT.TAB) {
					text_1.insert(new Character(SWT.TAB).toString());
				}
			}
		});
		text_1.addTraverseListener(new TraverseListener() {
			public void keyTraversed(TraverseEvent e) {
				if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail == SWT.TRAVERSE_TAB_PREVIOUS) {
					e.doit = false;
					e.detail = SWT.TRAVERSE_NONE;
				}
			}
		});
		
		shell.setSize(404, 380);
		shell.open();
//		while (!shell.isDisposed()) {
//			if (!display.readAndDispatch())
//				display.sleep();
//		}
//		display.dispose();
		
		return 0;
	}
}
Re: Text Widget spaces the TAB [message #898995 is a reply to message #898986] Mon, 30 July 2012 05:49 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2426
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
you could try:
text.setData( RWT.CANCEL_KEYS, new String[] { "TAB" } );
HTH,
Ivan

On 7/30/2012 5:32 AM, cho hyun jong wrote:
> Pressing TAB to move to the next widget without having to go I'd like
> to put a space in text.
>
> Why did not work?
> show you my code.
> thanks.
>
>
> public class TextWidgetText implements IEntryPoint {
> private Text text_1;
>
> /**
> * @wbp.parser.entryPoint
> */
> public int createUI() { final Display display = new
> Display();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout());
> int style = SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL;
>
> final Text text = new Text(shell, style);
> text.addKeyListener(new KeyAdapter() {
> @Override
> public void keyPressed(KeyEvent e) {
> System.out.println(e.keyCode);
>
> if(e.stateMask == 0 && e.keyCode == SWT.TAB) {
> text.insert(new Character(SWT.TAB).toString());
> }
> }
> });
> text.addTraverseListener(new TraverseListener() {
> public void keyTraversed(TraverseEvent e) {
> if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail ==
> SWT.TRAVERSE_TAB_PREVIOUS) {
> e.doit = false;
> e.detail = SWT.TRAVERSE_NONE;
> }
> }
> });
>
> text_1 = new Text(shell, SWT.BORDER);
> text_1.addKeyListener(new KeyAdapter() {
> @Override
> public void keyPressed(KeyEvent e) {
>
> if(e.stateMask == 0 && e.keyCode == SWT.TAB) {
> text_1.insert(new Character(SWT.TAB).toString());
> }
> }
> });
> text_1.addTraverseListener(new TraverseListener() {
> public void keyTraversed(TraverseEvent e) {
> if (e.detail == SWT.TRAVERSE_TAB_NEXT || e.detail ==
> SWT.TRAVERSE_TAB_PREVIOUS) {
> e.doit = false;
> e.detail = SWT.TRAVERSE_NONE;
> }
> }
> });
>
> shell.setSize(404, 380);
> shell.open();
> // while (!shell.isDisposed()) {
> // if (!display.readAndDispatch())
> // display.sleep();
> // }
> // display.dispose();
>
> return 0;
> }
> }
>

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: Text Widget spaces the TAB [message #898996 is a reply to message #898995] Mon, 30 July 2012 05:53 Go to previous message
Cho HyunJong is currently offline Cho HyunJongFriend
Messages: 106
Registered: July 2009
Location: korea
Senior Member

Thanks a lot...
very very~

Google Talk: hangum@gmail.com
blog : http://hangumkj.blogspot.com/
Tadpole for DB Tools : https://sites.google.com/site/tadpolefordb/
phone: 010-4227-3601

hangum
Previous Topic:From RWT to full RAP on Virgo
Next Topic:create a RAP Launch based on feature
Goto Forum:
  


Current Time: Fri Mar 29 09:40:58 GMT 2024

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

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

Back to the top