Hi,

I have to react on focus events that a writer-window (in the example
the currentComponent) may fire. The followin snippet is one approach,
but why do the methods focusLost(...) and focusGained(...) of my
listener never get called when I switch between the window on which
the listener has been registered and another ooo-window? (I never
happened to get this methods get called)

                XComponentContext ctx = Bootstrap.bootstrap();
                XDesktop desktop = (XDesktop) 
UnoRuntime.queryInterface(XDesktop.class,
                                
ctx.getServiceManager().createInstanceWithContext(
                                                "com.sun.star.frame.Desktop", 
ctx));
                XFrame frame = desktop.getCurrentFrame();
                XWindow w = (XWindow) UnoRuntime.queryInterface(XWindow.class, 
frame
                                .getContainerWindow());

                w.addFocusListener(new XFocusListener() {

                        public void disposing(EventObject arg0) {
                                System.out.println("ContainerWindow-disposing");
                        }

                        public void focusLost(FocusEvent arg0) {
                                System.out.println("ContainerWindow-focusLost");
                        }

                        public void focusGained(FocusEvent arg0) {
                                
System.out.println("ContainerWindow-focusGained");
                        }

                });
                
thanks,
Christoph

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to