Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT constant for space key
SWT constant for space key [message #464742] Tue, 29 November 2005 13:04 Go to next message
Eclipse UserFriend
Originally posted by: e.s.com

I would like to display content assist information when the user presses
both the CTRL and SPACE keys.

the code looks the following:
sourceViewer.getControl().addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
switch (e.keyCode) {
case // CTRL and SPACE :
assistant.showPossibleCompletions();
break;
default:
//ignore everything else
}
}
});

I couldn't find SWT.SPACE and how do I capture when the user presses both
keys?

thanks in advance
Re: SWT constant for space key [message #464744 is a reply to message #464742] Tue, 29 November 2005 13:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: friederich.kupzog.de

Hi,

the ASCII code for space is 32. Or use char == ' '.
Regards,
Friederich

Erel wrote:
> I would like to display content assist information when the user presses
> both the CTRL and SPACE keys.
> the code looks the following:
> sourceViewer.getControl().addKeyListener(new KeyAdapter() {
> public void keyPressed(KeyEvent e) {
> switch (e.keyCode) {
> case // CTRL and SPACE :
> assistant.showPossibleCompletions();
> break;
> default:
> //ignore everything else
> }
> }
> });
>
> I couldn't find SWT.SPACE and how do I capture when the user presses
> both keys?
>
> thanks in advance
>


--
Friederich Kupzog
Elektronik & Software
Neusser Str. 5-7
50670 Köln
Tel 0241 160696-1
Fax 0221 726670
www.kupzog.de/fkmk
Re: SWT constant for space key [message #464756 is a reply to message #464742] Tue, 29 November 2005 14:53 Go to previous message
Jeremy Dowdall is currently offline Jeremy DowdallFriend
Messages: 48
Registered: July 2009
Member
if ( (e.character == ' ') && ((e.stateMask & SWT.CTRL) != 0) ) {
assistant.showPossibleCompletions();
}



Erel wrote:
> I would like to display content assist information when the user presses
> both the CTRL and SPACE keys.
> the code looks the following:
> sourceViewer.getControl().addKeyListener(new KeyAdapter() {
> public void keyPressed(KeyEvent e) {
> switch (e.keyCode) {
> case // CTRL and SPACE :
> assistant.showPossibleCompletions();
> break;
> default:
> //ignore everything else
> }
> }
> });
>
> I couldn't find SWT.SPACE and how do I capture when the user presses
> both keys?
>
> thanks in advance
>
Previous Topic:Doublebuffering with SWT
Next Topic:Missing keyborad events
Goto Forum:
  


Current Time: Sat Dec 07 23:46:32 GMT 2024

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

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

Back to the top