Apache OpenOffice (AOO) Bugzilla – Issue 74385
com.sun.star.awt.XMessageBox becomes visible before execute is called
Last modified: 2009-04-23 15:16:02 UTC
After a com.sun.star.awt.XMessageBox is created with "createMessageBox" it becomes immediately visible. I find this behaviour confusing although of cours the messagebox does not become active before the "execute" method has been called. the following codesnippet can be used to reproduce the issue: Object oToolkit = m_xMCF.createInstanceWithContext("com.sun.star.awt.Toolkit", m_xContext); XMessageBoxFactory xMessageBoxFactory = (XMessageBoxFactory) UnoRuntime.queryInterface(XMessageBoxFactory.class, oToolkit); // rectangle may be empty if position is in the center of the parent peer Rectangle aRectangle = new Rectangle(); XMessageBox xMessageBox = xMessageBoxFactory.createMessageBox(_xParentWindowPeer, aRectangle, "errorbox", com.sun.star.awt.MessageBoxButtons.BUTTONS_OK, _sTitle, _sMessage); if (xMessageBox != null){ short nResult = xMessageBox.execute(); }
cd: Accepted.
Created attachment 45833 [details] The line "pWindow->Show();" which shows the message box ahead is removed.
cd: Change task to patch. Will check patch from LiangWeike.
cd: Accepted and committed to CWS fwk66.
cd->tm: The following Basic script can be used to verify the issue. The full script should show the message box. To verify that the message box is not visible after creating it (via createMessageBox) just comment out the last statement and start the script again. The message box shouldn't be visible. Please verify. REM ***** BASIC ***** Sub Main oMsgBoxFactory = createUnoService( "com.sun.star.awt.Toolkit" oDesktop = createUnoService( "com.sun.star.frame.Desktop" ) REM ***** Empty rectangle means use default values ***** Dim aRectangle as new com.sun.star.awt.Rectangle oButtons = com.sun.star.awt.MessageBoxButtons.BUTTONS_YES_NO_CANCEL+com.sun.star.awt.MessageBoxButtons.DEFAULT_BUTTON_YES REM ***** Don not use getCurrentFrame() in your relase code!! ***** REM ***** This example uses it just be small ***** oParent = oDesktop.getCurrentFrame().getContainerWindow() oMsgBox = oMsgBoxFactory.createMessageBox( oParent, aRectangle, "infobox", oButtons, "Title", "This is the message box text" ) oMsgBox.execute() End Sub
checked and verified in cws fwk66 -> OK !
closed