[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: keylistener doesn't work

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.