showInfoModal() behaves different on win and linux

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

showInfoModal() behaves different on win and linux

Christoph Lutz
Hi,

I'm using the method showInfoModal(..) from the example
OpenOffice.org2.0_SDK/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.javato
create an infobox.

On windows 2000 (OOo2.0.2, 680m162) the new infobox pops up in the CENTER of
the parent-window,
On linux (OOo2.0, 680m3) the new infopox pops up in the UPPER LEFT corner of
the parent-window.

Which behaviour is the correct one? And what can I do to place the infobox
into the center of the parent-window on both systems?

best regards,
Christoph


copied from AsyncJob.java:

    /** show an info box with the UNO based toolkit.
     *
     *  It tries to use the container window of a may well know
     *  office frame as parent. If such parent window could be located,
     *  the info box can be shown in modal mode. If a parent is missing
     *  (because this job is called inside an EXECUTOR environment, which
     *  does not set any frame context here) the info box can't be created!
     *  Because the toolkit needs parents for non top level windows ...
     *  In that case the only way is to implement this info box
     *  native or make it non modal using java dialogs inside it's own
thread ...
     *  (see showInfoNonModal() too)
     *
     *  @param  xParent
     *          used as parent window of the shown info box.
     *
     *  @param  sTitle
     *          is shown as title of the info box.
     *
     *  @param  sMessage
     *          inclused the message body, which is shown as info.
     */

    private void showInfoModal( com.sun.star.awt.XWindow xParent  ,
                                java.lang.String         sTitle   ,
                                java.lang.String         sMessage )
    {
        try
        {
            // get access to the office toolkit environment
            com.sun.star.awt.XToolkit xKit = (com.sun.star.awt.XToolkit
)UnoRuntime.queryInterface(
                 com.sun.star.awt.XToolkit.class,
                 m_xCmpCtx.getServiceManager().createInstanceWithContext("
com.sun.star.awt.Toolkit",

m_xCmpCtx));

            // describe the info box ini it's parameters
            com.sun.star.awt.WindowDescriptor aDescriptor = new
com.sun.star.awt.WindowDescriptor();
            aDescriptor.WindowServiceName = "infobox";
            aDescriptor.Bounds            = new com.sun.star.awt.Rectangle
(0,0,300,200);
            aDescriptor.WindowAttributes  =
com.sun.star.awt.WindowAttribute.BORDER   |

com.sun.star.awt.WindowAttribute.MOVEABLE |

com.sun.star.awt.WindowAttribute.CLOSEABLE;
            aDescriptor.Type              =
com.sun.star.awt.WindowClass.MODALTOP;
            aDescriptor.ParentIndex       = 1;
            aDescriptor.Parent            = (com.sun.star.awt.XWindowPeer
)UnoRuntime.queryInterface(

com.sun.star.awt.XWindowPeer.class,
                                                xParent);

            // create the info box window
            com.sun.star.awt.XWindowPeer xPeer    = xKit.createWindow
(aDescriptor);
            com.sun.star.awt.XMessageBox xInfoBox = (
com.sun.star.awt.XMessageBox)UnoRuntime.queryInterface(

com.sun.star.awt.XMessageBox.class,
                                                        xPeer);
            if (xInfoBox == null)
                return;

            // fill it with all given informations and show it
            xInfoBox.setCaptionText(sTitle);
            xInfoBox.setMessageText(sMessage);
            xInfoBox.execute();
        }
        catch(java.lang.Throwable exIgnore)
        {
            // ignore any problem, which can occure here.
            // It's not realy a bug for this example job, if
            // it's message could not be printed out!
        }
    }
Reply | Threaded
Open this post in threaded view
|

Re: showInfoModal() behaves different on win and linux

Mathias Bauer
Christoph Lutz wrote:

> Hi,
>
> I'm using the method showInfoModal(..) from the example
> OpenOffice.org2.0_SDK/examples/DevelopersGuide/Components/Addons/JobsAddon/AsyncJob.javato
> create an infobox.
>
> On windows 2000 (OOo2.0.2, 680m162) the new infobox pops up in the CENTER of
> the parent-window,
> On linux (OOo2.0, 680m3) the new infopox pops up in the UPPER LEFT corner of
> the parent-window.
>
> Which behaviour is the correct one? And what can I do to place the infobox
> into the center of the parent-window on both systems?

It's possible that both are "correct", in general the default position
of a dialog is system dependent (so on Linux depends on the window
manager). But that's only a guess.

In case you don't get further answers here you might want to ask on the
[hidden email] mailing list.

Best regards,
Mathias

--
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [hidden email] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]