Non-Modal Dialog Contents not displaying properly

Hi Everyone

I’m writing a BASE application in Windows (v24.8.03), and I have created a non-modal window to let the users know that an operation is executing: There’s just a label in the dialog, no user-interaction is necessary.

When I call the dialog using .SetVisible(true), a blank window appears (with a close window X in the top right corner), with no contents, and which disappears correctly when I issue .SetVisible(false).

Following the examples I have seen in the documentation, I have set up global variables to track whether the dialog has been loaded or not. Additionally, I have a function msgMaker() that translates the message into the user’s language. (When I issue .execute() for a modal dialog, the dialog content appears correctly, but I want non-modal)

I would dearly love to have a non-modal window with the label displaying, if possible without the close window option for the dialog.

I would be grateful for any advice on this. The code is below:

Best wishes,

CB

I execute :

Global oNMDialog AS Object
Global gDlgLoaded AS Boolean

 If gDlgLoaded = 0 then  'is the dialog already in memory? No

    With GlobalScope.BasicLibraries  'not sure I need this...
         If ( Not .isLibraryLoaded("Tools") ) Then
            .LoadLibrary( "Tools" )
         End If
    End With 

    ThisComponent.DialogLibraries.loadLibrary("DlgLib")
    
    oDialogLibrary = ThisComponent.DialogLibraries.GetByName("DlgLib")       
    oModule=oDialogLibrary.getByName("DlgPlsWaitAdding")        

    gDlgLoaded = 1   
   
    oNMDialog=CreateUnoDialog(oModule)

    oLabel1 = oNMDialog.GetControl("Label1")
    oLabel1.Text = msgMaker(15)  'set contents to correct language
    
 End if

 oNMDialog.setVisible(true)

 'issue commands     ...
 
 oNMDialog.setVisible(false)

Please upload a test file with a modal dialog and we will convert it into a non-modal one.

Try this.
You can call the ShowNMDialog and StopNMDialog macros multiple times.

Option Explicit

Global oNMDialog AS Object

Sub ShowNMDialog()
  Dim oDoc As Object, oDP As Object
  Dim args(0) As New com.sun.star.beans.NamedValue
  oDoc=ThisComponent
   
  If oNMDialog Is Nothing Then
    oDoc.DialogLibraries.loadLibrary("DlgLib")

    oDP = GetProcessServiceManager.createInstanceWithArguments("com.sun.star.awt.DialogProvider2", Array(oDoc)) 
    args(0).Name = "ParentWindow"
    args(0).Value = oDoc.CurrentController.Frame.ContainerWindow
    oNMDialog = oDP.createDialogWithArguments("vnd.sun.star.script:DlgLib.DlgPlsWaitAdding?location=document", args)
    oNMDialog.GetControl("Label1").Text = "Please Wait!"
  End If 

  oNMDialog.setVisible True
End Sub

Sub StopNMDialog()
  If Not (oNMDialog Is Nothing) Then
    oNMDialog.setVisible False
  End If  
End Sub

Dlglib.ods (12.6 KB)