PDA

View Full Version : [JAVA + SWT]simulare carriage retur


thebol
25-05-2007, 11:48
HO un problema. Ho un text widget e devo fare in modo che quando premo il tasto tab, inserisca un carriage return.



if(ev.keyCode == SWT.TAB) {
text.setDataValue(text.getDataValue() + CARRIAG_RETURN);
}


ora nel data value mi ritrovo la sequenza di caratteri giusta. Solo che il cursore non si sposta gił.
Ho anche provato a creare un evento SWT.CR ma non esegue il ritorno a capo.

Nessuno ha qualche idea?

thebol
25-05-2007, 12:36
noteML.getControl().setSelection(Integer.MAX_VALUE);

e ve lo portera all'ultimo carattere :rulez: