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] Sun, 29 July 2012 22:32 Go to next message
Cho HyunJong is currently offline Cho HyunJong
Messages: 46
Registered: July 2009
Location: korea
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 01:49 Go to previous messageGo to next message
Ivan Furnadjiev is currently offline Ivan Furnadjiev
Messages: 1691
Registered: July 2009
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 01:53 Go to previous message
Cho HyunJong is currently offline Cho HyunJong
Messages: 46
Registered: July 2009
Location: korea
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:Testing: Widget Id on Toolbars
Next Topic:create a RAP Launch based on feature
Goto Forum:
  


Current Time: Sun Apr 20 15:49:16 EDT 2014

Powered by FUDForum. Page generated in 0.03084 seconds