Issue 74385

Summary: com.sun.star.awt.XMessageBox becomes visible before execute is called
Product: General Reporter: berend.cornelius
Component: scriptingAssignee: thorsten.martens
Status: CLOSED FIXED QA Contact: issues@framework <issues>
Severity: Trivial    
Priority: P3 CC: issues
Version: 680m199   
Target Milestone: OOo 2.3   
Hardware: All   
OS: All   
Issue Type: PATCH Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 72764    
Attachments:
Description Flags
The line "pWindow->Show();" which shows the message box ahead is removed. none

Description berend.cornelius 2007-02-09 14:41:46 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();
    }
Comment 1 carsten.driesner 2007-03-08 08:15:37 UTC
cd: Accepted.
Comment 2 liangweike 2007-06-12 07:59:28 UTC
Created attachment 45833 [details]
The line "pWindow->Show();" which shows the message box ahead is removed.
Comment 3 carsten.driesner 2007-06-12 08:12:19 UTC
cd: Change task to patch. Will check patch from LiangWeike.
Comment 4 carsten.driesner 2007-06-12 08:25:17 UTC
cd: Accepted and committed to CWS fwk66.
Comment 5 carsten.driesner 2007-06-21 09:32:37 UTC
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 
Comment 6 thorsten.martens 2007-06-27 13:47:35 UTC
checked and verified in cws fwk66 -> OK !
Comment 7 thorsten.martens 2009-04-23 15:16:02 UTC
closed