Win 11 25H2, LibreOffice 25.8.3.2
Ubuntu 24.04.3 LTS, LibreOffice 24.2.7.2
This calls ScriptForge, so it won't work in OO.
This is a demonstration of code that makes it possible to incorporate non-modal dialogs (NMDs) into a project without writing any new code. Since dialogs ordinarily require some code, this makes NMDs available to people who otherwise wouldn't be able to use them. If you decide to incorporate NMDs into your project, you need to know how to create them, open them in dialog design view, rename them, move them from one file to another, etc. In the Base Tutorial section of this forum, I've posted a tutorial on working with dialogs in LibreOffice.
This contains everything needed to add NMDs to an existing project without writing any new code. There are two macros: one for the buttons that open NMDs and one for the buttons that close NMDs There are no limits to the count of NMDs that can be open at the same time, aside from your computer's physical memory.
For this to work, form documents, button controls, and dialogs have to be named in a particular way. The code uses the form doc name and the button name to derive the dialog name so that it knows which dialog to open.
The easiest way to incorporate this into a project is to either use a copy of this demo as the starting point, or to copy the forms and dialogs from an existing project file to a copy of this file. In the first case, if you start with the correct names, or in the second case if you change the names so that the code can find the dialogs, you won't need to do much else.
In addition to a general purpose informational NMD, the demo includes a second type that can be used to type notes relating to a particular form document, store them, and retrieve them later.
For coders, this demonstrates:
- Use of ScriptForge regular expressions
- Avoiding some of the pitfalls of window listeners
- Ensuring that the X in the title bar and the close button cause the same code to run when the dialog closes
- Using one open procedure for two different types of NMDs