KeyEvent - Character and CTRL [message #42855] |
Wed, 22 January 2003 07:08  |
Eclipse User |
|
|
|
Originally posted by: meshulam.il.ibm.com
A key with CRTL pressed on a Control (Table), for example 'A'+CTRL.
KeyReleased gets a KeyEvent.
Checking e.stateMask & SWT.CONTROL shows that the CTRL was pressed,
but in e.character could not get the right character.
|
|
|
|
Re: KeyEvent - Character and CTRL [message #43188 is a reply to message #42948] |
Thu, 23 January 2003 04:39  |
Eclipse User |
|
|
|
Originally posted by: meshulam.il.ibm.com
David Whiteman wrote:
> Post to eclipse.tools and/or create a Bugzilla report
> "Noga Meshulam" <meshulam@il.ibm.com> wrote in message
> news:b0m1jq$44j$1@rogue.oti.com...
> > A key with CRTL pressed on a Control (Table), for example 'A'+CTRL.
> > KeyReleased gets a KeyEvent.
> > Checking e.stateMask & SWT.CONTROL shows that the CTRL was pressed,
> > but in e.character could not get the right character.
> >
> >
> >
I report on Bugzilla, but it seams that they did not understand the problem
Here is an example that shows the problem.
It happen for other controls such as Text, not only for Table
package com.ibm.hrl.lds.local.ui;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.events.*;
public class TableKeyBug {
Shell shell;
public TableKeyBug () {
shell = new Shell (new Display (), SWT.CLOSE | SWT.TITLE);
shell.setText ("Table Key Bug ");
shell.setLayout (new FillLayout ());
Table table = new Table (shell, SWT.V_SCROLL | SWT.H_SCROLL |
SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.WRAP);
table.setSize (100,100);
table.addKeyListener (new KeyAdapter () {
public void keyReleased (KeyEvent e) {
if ((e.stateMask & SWT.CONTROL) == SWT.CONTROL) {
System.out.println ("keyReleased CONTROL");
}
// in case of CTRL+character, don't get it in e.character !!!!!
System.out.println ("keyReleased Character = "+e.character);
}
});
}
public Shell getShell () {
return shell;
}
public static void main (String [] args) {
TableKeyBug table = new TableKeyBug ();
Shell shell = table.getShell ();
Display display = shell.getDisplay ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
display.dispose ();
}
}
|
|
|
Re: KeyEvent - Character and CTRL [message #589156 is a reply to message #42855] |
Wed, 22 January 2003 11:41  |
Eclipse User |
|
|
|
Post to eclipse.tools and/or create a Bugzilla report
"Noga Meshulam" <meshulam@il.ibm.com> wrote in message
news:b0m1jq$44j$1@rogue.oti.com...
> A key with CRTL pressed on a Control (Table), for example 'A'+CTRL.
> KeyReleased gets a KeyEvent.
> Checking e.stateMask & SWT.CONTROL shows that the CTRL was pressed,
> but in e.character could not get the right character.
>
>
>
|
|
|
Re: KeyEvent - Character and CTRL [message #589248 is a reply to message #42948] |
Thu, 23 January 2003 04:39  |
Eclipse User |
|
|
|
Originally posted by: meshulam.il.ibm.com
David Whiteman wrote:
> Post to eclipse.tools and/or create a Bugzilla report
> "Noga Meshulam" <meshulam@il.ibm.com> wrote in message
> news:b0m1jq$44j$1@rogue.oti.com...
> > A key with CRTL pressed on a Control (Table), for example 'A'+CTRL.
> > KeyReleased gets a KeyEvent.
> > Checking e.stateMask & SWT.CONTROL shows that the CTRL was pressed,
> > but in e.character could not get the right character.
> >
> >
> >
I report on Bugzilla, but it seams that they did not understand the problem
Here is an example that shows the problem.
It happen for other controls such as Text, not only for Table
package com.ibm.hrl.lds.local.ui;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.events.*;
public class TableKeyBug {
Shell shell;
public TableKeyBug () {
shell = new Shell (new Display (), SWT.CLOSE | SWT.TITLE);
shell.setText ("Table Key Bug ");
shell.setLayout (new FillLayout ());
Table table = new Table (shell, SWT.V_SCROLL | SWT.H_SCROLL |
SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.WRAP);
table.setSize (100,100);
table.addKeyListener (new KeyAdapter () {
public void keyReleased (KeyEvent e) {
if ((e.stateMask & SWT.CONTROL) == SWT.CONTROL) {
System.out.println ("keyReleased CONTROL");
}
// in case of CTRL+character, don't get it in e.character !!!!!
System.out.println ("keyReleased Character = "+e.character);
}
});
}
public Shell getShell () {
return shell;
}
public static void main (String [] args) {
TableKeyBug table = new TableKeyBug ();
Shell shell = table.getShell ();
Display display = shell.getDisplay ();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ())
display.sleep ();
}
display.dispose ();
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.04674 seconds