Hi all,

a simple task for Basic:
a modal dialog should be executed and closed *without* any user interaction.
Therefore I used the persistent eventbinding _onGotFocus for the dialog. Calling Dlg.execute() fires the event _before_ the dialog is appearing on screen.

Is this the correct behaviour?

The following code snippet with a PaintListener solves the problem:

Dim oPaintListener as Any

Sub Main()
        Dim oDlg as Any
        oDlg = CreateUnoDialog(DialogLibraries.Standard.Dialog1)
        oPaintListener = _
        CreateUNOListener("Dialog_","com.sun.star.awt.XPaintListener")
        oDlg.AddPaintListener(oPaintListener)
        oDlg.SetEnable(False)
        oDlg.Execute()
        oDlg.dispose()
End Sub

Sub Dialog_windowPaint(e)
Dim i as Integer
Dim oDlg as Any, oProgressBar as Any

        oDlg = e.Source
        oDlg.RemovePaintListener(oPaintListener)
        'Do something and tell the user about it
        oProgressBar = oDlg.GetControl("ProgressBar1")
        For i = 0 to 100
                oProgressBar.Value = i
                wait 30
        next
        oDlg.EndExecute()
End Sub

Don't move the command oDlg.dispose to the event routine, oo will crash (m89).

Regards
Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to