Libre Error Handling

I have a function with an Error Handler in which the error occurs after a Dialog is shown
dial is my Dialog object
but the msgbox executes only after I close the Dialog

Any way to get this to show the moment the line is reached ?

sub func

on error goto Handler
dial.execute()

d=0
d= 9/d

exit sub
Handler:
msgbox “Error”
end sub

Do you mean “the moment the d= 9/d line is reached”? Then it already does as you want. The line is only reached after execute() finishes, which only happens after you close the dialog; until then, the sub func waits for the dial.execute() line to end.

In other words, execute() executes a modal dialog.

1 Like

thanks Mike
i meant when the Line in the Handler is reached.
the msgbox
That would make sense correct ?
In such situations I obviously want to alert the user of the error instantly rather than wait for him to close the dialog.

Again, you see the msgbox at the very moment when its line is reached. What you seem to not see is that your function does not proceed after it reaches dial.execute(), until the execute ends - and the execute is everything from showing your dial up to closing it.

Yes i just tried doing a normal msgbox after dial.execute and it behaves just the way you said. it doesn’t show until i close the dialog
it’s modal
so then, what I’m obviously looking to know is - if I’m running some code after executing the Dialog then there’s no way to show a popup alert ??

Sigh.

You need to take some time and realize the concept.

The code that you put after you call execute is not executed in parallel with your dialog. It is executed only after the dialog ends its execution, which is what modal dialog means.

Your question seems to be “how do I run a modeless dialog”, i.e. "what do I use instead of execute()"

yes mike - i got all that
whether modal or non modal
is there a way , any solution to alert a pop up after a dialog is executed ?
that is the simple question
u repeatedly trying to tell me what’s happening here
lets leave that aside
do you know of a way to achieve what i want ?

No you don’t make an effort to show you got anything. If you did, you would not write the nonsense like “after a dialog is executed”, because “after it is executed” means “after execute ended”, which already works. What you wanted is “to do something after the dialog is shown, while it is still being executing”.

Use its visible = true instead of execute().

haha at last you got what i was after … phew
visible true or whatever
that was the possible solution which anyone with some common sense in understanding a question would have given straight off instead of banging on about execute, modal etc. like an idiot

He answered the question you asked. With practice, you can learn to ask better questions that clearly convey your goal. Also you did not make much of an attempt to understand his responses.

And don’t call one of our most valuable contributors an idiot! Apparently you have no idea how much he has done for LibreOffice.

Now that the solution has been given, please mark the solution.