[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [platform-swt-dev] getting key events....
|
Have you tried this?
new KeyListener() {
public void keyPressed(KeyEvent ev) {
if (ev.character=='\r' || ev.character == '\n') {
}
}
I never tried this on multiline text, but it can work on single line text.
jml
----- Original Message -----
From: "NMG" <nmg_here@xxxxxxxxx>
To: <platform-swt-dev@xxxxxxxxxxx>
Sent: Wednesday, October 23, 2002 4:18 PM
Subject: [platform-swt-dev] getting key events....
> Hello everybody,
>
> In my current SWT application, I wanted to have a
> multiline Text (equivalent to an AWT text area) and
> wanted to capture the enter key event. I tried with
> the KeyListner but the keyCode returned is 0 (zero)
> for all keys and no character (in KeyEvent class) is
> returned for keys like enter, backspace, spacebar etc.
>
> I also tried with combinations of Listeners
> (modify/verify/key) but did not succeed.
>
> Instead if we use single line text then it works,
> somthing like...
>
> Text t = new Text(_shellPCon, SWT.BORDER |
> SWT.SINGLE);
> t.addListener (SWT.DefaultSelection, new Listener () {
> public void handleEvent (Event e) {
> doSomething();
> }
> });
>
> In short, what is the alternate of
> java.awt.event.KeyEvent.VK_ENTER?
>
> Note: thanks very much guys, for the SWT specification
>
> clue.
>
> nmg.
>
>
> __________________________________________________
> Do you Yahoo!?
> Y! Web Hosting - Let the expert host your web site
> http://webhosting.yahoo.com/
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/platform-swt-dev