Ask Your Question

Calc BASIC: How to popup a dialog ?

asked 2020-02-03 10:32:11 +0200

lonk gravatar image

updated 2020-02-03 10:32:34 +0200

Why ' oDialog.setVisible(True) is not necessary ?

And why does oDialog.Execute() work instead ?


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-02-03 21:23:19 +0200

Ratslinger gravatar image

updated 2020-02-03 22:26:48 +0200


The answer is - Because it is already a part of the Execute function.

But of course this raises other questions like what is it used for? A general understanding of dialogs is needed.

There are two methods to create a dialog - runtime (all code) and graphically (through the Basic IDE).

There is also the characteristic of a dialog to be 'modal' (cannot access parent until closed) or 'non-modal' (parent is desktop). Each are present in LO and depends upon the need. With 'modal' there is no ability to do something with the document until the dialog is closed. With 'non-modal' you can do something with the document (example: selecting cells) without the dialog being closed. This is helpful when the dialog relies upon a selection made on the document.

With that background, the 'setVisible' function is helpful in creaing a 'non-modal' dialog when it was designed through the IDE (graphically). For a brief discussion on this, see the comments in the answer on this post: How to create a modeless ( non modal) dialog. Also note the link in my final comment there.

For a runtime dialog, see the sample posted in my question here: Looking to create grid (not table) control on Base form

Also should mention that your sample is missing a couple of elements. After the Execute statement you should have a oDialog.dispose() line to free up the resource. Also your dialog has no button assigned as OK. This would close (end execution) the dialog.


One more note of importance, with 'setVisible' the next statement in the sub is executed immediately. With the 'Execute' statement the next statement will not execute until the dialog is closed.

edit flag offensive delete link more


Dear @Ratslinger,

Thank you so much for your support and your concern.

lonk gravatar imagelonk ( 2020-02-04 08:14:19 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-02-03 10:32:11 +0200

Seen: 326 times

Last updated: Feb 03 '20