You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Gerardo Gómez <ge...@gmail.com> on 2011/11/12 07:45:28 UTC

X button (the default close botton) on non modal dialogs of UNO-AWT doesn't close the dialog

Hello.
I have a problem with the implementation of the dialogs of UNO-AWT. When i
show the dialog as non-modal, using the setVisible method from the XWindow
interface, the showed dialog doesn't close or hides when i press the "x"
button (the default close button of all windows). Is it possible to close
the dialog with the default close button, or as a modal dialog that method
doesn't work?.

P.S: I use this method to show or hide a dialog.

public void setVisible(boolean visible){
//        If this dialog is modal...
        if (modal){
            if (visible){
//                ...it uses execute to show the dialog.
                this.xDialog.execute();
            }
            else{
//                ...it uses endExecute to hide the dialog.
                this.xDialog.endExecute();
            }
        }
//        If this dialog is not modal...
        else{
//            ...it uses the setVisible method from the xWindow object.
            this.xWindow.setVisible(visible);
        }
    }

Thanks.

Re: [API] Re: X button (the default close botton) on non modal dialogs of UNO-AWT doesn't close the dialog

Posted by Gerardo Gómez <ge...@gmail.com>.
Hello Ariel, thanks for your anwser, it works great. I use this code to do
it:

this.xTopWindow = (XTopWindow) UnoRuntime.queryInterface(XTopWindow.class,
this.xDialog);
this.xTopWindow.addTopWindowListener(new XTopWindowListener(){

            public void windowClosing(EventObject arg0) {
                setVisible(false);
            }

//            ...here goes the other implemented methods (windowOpened,
windowClosed, etc).
});

On Sat, Nov 12, 2011 at 3:28 AM, Ariel Constenla-Haile <
ariel.constenla.haile@gmail.com> wrote:

> Hello Gerardo,
>
> On Sat, Nov 12, 2011 at 12:45:28AM -0600, Gerardo Gómez wrote:
> > Hello.
> > I have a problem with the implementation of the dialogs of UNO-AWT. When
> i
> > show the dialog as non-modal, using the setVisible method from the
> XWindow
> > interface, the showed dialog doesn't close or hides when i press the "x"
> > button (the default close button of all windows). Is it possible to close
> > the dialog with the default close button, or as a modal dialog that
> method
> > doesn't work?.
>
> the css.awt.XDialog is a css.awt.XTopWindow, add
> a css.awt.XTopWindowListener and when its  windowClosing() gets invoked
> you can call css.awt.XWindow.setVisible( false ) and then dispose.
>
> This should work (== I didn't test it).
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>

[API] Re: X button (the default close botton) on non modal dialogs of UNO-AWT doesn't close the dialog

Posted by Ariel Constenla-Haile <ar...@gmail.com>.
Hello Gerardo,

On Sat, Nov 12, 2011 at 12:45:28AM -0600, Gerardo Gómez wrote:
> Hello.
> I have a problem with the implementation of the dialogs of UNO-AWT. When i
> show the dialog as non-modal, using the setVisible method from the XWindow
> interface, the showed dialog doesn't close or hides when i press the "x"
> button (the default close button of all windows). Is it possible to close
> the dialog with the default close button, or as a modal dialog that method
> doesn't work?.

the css.awt.XDialog is a css.awt.XTopWindow, add
a css.awt.XTopWindowListener and when its  windowClosing() gets invoked
you can call css.awt.XWindow.setVisible( false ) and then dispose.

This should work (== I didn't test it).

Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina