Information message during macro execution

Hi,
Sometimes our macros can run during some time.
For instance 1 minute can be considered a considerable time.
Sometimes during that time one can’t see what’s going on with the code execution.
So without any more considerations my question is:
Are there some tipe of “MsgBox” that doesn’t interrupt code execution?
“MsgBox” is not bad the problem is that one must at least always click once the mouse when the message appears.
I think this feature would improve information about macro execution.
Many thanks.

Sorry but I do not understand. Calc himself, when performing a long operation, draws a green bar in the StatusBar and does not pester the user with messages in MsgBox. Why don’t you use the StatusBar in your program?

Hi,
you might try the ShowProgressBar() method of the UI service, part of the ScriptForge libraries.

Description on https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_ui.html?&DbPAR=BASIC#ShowProgressBar

Briefly:
Displays a non-modal dialog box. Specify its title, an explicatory text and a percentage of progress to be represented on a progressbar. The dialog will remain visible until a call to the method without arguments or until the user manually closes the dialog.

Simple code:

Dim i As Integer, ui As Object
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
ui = CreateScriptService("UI")
For i = 0 To 100
    ui.ShowProgressBar("Window Title", "Progress ..." & i & "/100", i)
    Wait 50
Next i
' Closes the Progress Bar window
ui.ShowProgressBar()

The ui.SetStatusBar() method is similar and a good alternative too.

Hi,
Thanks a lot for your answer.
It is simple and works fine.
Nevertheless there is a little issue, because at the begining I don’t know how many rows I’ll be processing, so I can’t calculate a percentage.
The problem can be solved without passing the third parameter to the method “ShowProgressBar”.
But this way I get a static grey bar in the bottom of the dialog box.
What would be perfect it would be a simple non-modal message box, whose text could be changed during the processing.
Do you know such a solution?
Thanks in advance.

Like this?

@lv2eof
You can either:

  • freeze the progress on the progress bar (0, 50, 100% ?) and call ShowProgressBar with a different text at every stage,
    or
  • design by yourself a dialog and use the “Dialog” service of the ScriptForge libraries: it supports both modal and non-modal modes. (Help about the dialog service).