> I've made a simple example which shows the same thing in eclipse
> (tar/gziped the entire project). You can start the dialog either with a press 
> on
> the pushbutton or via the menuitem selection - Start.java is the Application.
> 
> The behaviour, at least as it is for me, is that the modeless dialog is shown
> initially, but hidden behind the main frame after the menu is redrawn. This
> behaviour does not happen when using the pushbutton.

It looks like this is what's happening:

1. You select the menu item and the action fires
2. Your dialog is opened and will be shown in the foreground for a short time
3. The handling of the menu item sends the focus back to the frame which 
contains the menu item, or possibly the menu item itself, which will put the 
newly opened window in the background again.

You can try this piece of nasty code to open the dialog in ActionTest.java:

        new Thread() {
            public void run() {
                try {
                    Thread.sleep(500);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                ApplicationContext.queueCallback(new Runnable() {
                    public void run() {
                        dialog.open(Window.getActiveWindow().getDisplay());
                    }
                });
            }
        }.start();

(instead of just dialog.open()).

Since I sleep for half a second there, the menu item handling has completed, 
and the dialog will show up correctly. What's causing this I don't know though.

-- Edvin

Reply via email to