Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » keylistener doesn't work
keylistener doesn't work [message #462946] Fri, 21 October 2005 16:14 Go to next message
Eclipse UserFriend
Originally posted by: jeanvalery.ifrance.com

Hi!
Here's my problem.
I've got a main class that launches a display and a shell (MainShell).
It call a class (ScreenClass) that creates a second shell (SecondShell) to
draw a screen (a set of composites).
(The MainShell is not displayed, but it has to exist for tests and other
things like that... I create MainShell but I make it unvisible and do not
pack/open it!)
The shell "SecondShell" is public in the class "ScreenClass".

I tried to apply a keylistener on SeconShell from the main class, but it
didn't work. I tried to apply the keylistener on SecondShell in
ScreenClass, but it failed too.

However, when i apply the keylistener on MainShell in the main class, it
works, if I pack/open MainShell and make it visible. What's more,
MainShell must be focused so that the keylistener works.

But i don't want MainShell to be visible, nor it has the focus.

I want to apply a keyListener on SecondShell, whatever way I do it.

Does anyone got any idea?

Thanks a lot.

jean.
Re: keylistener doesn't work [message #463046 is a reply to message #462946] Tue, 25 October 2005 21:08 Go to previous message
Brad Reynolds is currently offline Brad ReynoldsFriend
Messages: 309
Registered: July 2009
Senior Member
I'm just guessing here but it sounds like the second shell isn't
receiving key events because one of it's children has focus. These
don't bubble up to the shell level. Your main shell receives the events
because it has no children and is the current focused control. Just a
guess, a snippet might help if that's not it.

jeanvalery wrote:
> Hi!
> Here's my problem.
> I've got a main class that launches a display and a shell (MainShell).
> It call a class (ScreenClass) that creates a second shell (SecondShell)
> to draw a screen (a set of composites).
> (The MainShell is not displayed, but it has to exist for tests and other
> things like that... I create MainShell but I make it unvisible and do
> not pack/open it!)
> The shell "SecondShell" is public in the class "ScreenClass".
>
> I tried to apply a keylistener on SeconShell from the main class, but it
> didn't work. I tried to apply the keylistener on SecondShell in
> ScreenClass, but it failed too.
>
> However, when i apply the keylistener on MainShell in the main class, it
> works, if I pack/open MainShell and make it visible. What's more,
> MainShell must be focused so that the keylistener works.
>
> But i don't want MainShell to be visible, nor it has the focus.
>
> I want to apply a keyListener on SecondShell, whatever way I do it.
>
> Does anyone got any idea?
>
> Thanks a lot.
>
> jean.
>
Previous Topic:Does browser rendering occur in the Display thread?
Next Topic:Multiple Selection for CheckboxTreeViewer
Goto Forum:
  


Current Time: Sat Apr 20 00:32:10 GMT 2024

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

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

Back to the top