keylistener doesn't work [message #462946] |
Fri, 21 October 2005 16:14 |
Eclipse User |
|
|
|
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 |
Brad Reynolds 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.
>
|
|
|
Powered by
FUDForum. Page generated in 0.04188 seconds