[Tutorial] Working with dialogs in OpenOffice

Forum rules
No question in this section please
For any question related to a topic, create a new thread in the relevant section.
Post Reply
fcsw
Posts: 12
Joined: Sun Aug 31, 2025 8:49 am
Location: Mars

[Tutorial] Working with dialogs in OpenOffice

Post by fcsw »

In this tutorial you will
  • learn to find objects in the Basic Macro Organizer
  • create a library
  • create a module
  • create and delete dialogs
  • export and import a dialog
  • create a cloned copy of a dialog with a new name.
The Basic Macro Organizer:

The Basic Macro Organizer displays and organizes the objects you're going to be working with.

Create a new odb file named newDatabase.odb. Go to the Tools menu -> Macros -> Organize Macros -> OpenOffice Basic ... Click the Organizer button. Click the Libraries tab. In the listbox near the top, select newDatabase.odb. You will see that you have the default library, named Standard. Click the New button, type "Dialogs", and save.

Click on the Modules tab. Double click on newDatabase.odb. You will see your two libraries, represented by icons with yellow folders behind white scrolls.
`
Select the Standard library and click the New button, creating the Module1 module. This is represented by a white scroll icon.

Click on the Dialogs tab. Double click newDatabase.odb. Click the Dialogs library. Click the New button. Type "dlgFirstName" and save. You will see your new dialog, represented by a square blue and white icon.

Click on the new dialog name, and you will see it blink, which means the name can be edited. Change the name to "dlgSecondName". Click anywhere outside the name or press the Enter key and your edit will be saved.


Find dialog design view:

A lot of the tasks you want to perform must be done in dialog design view. But the steps for entering dialog design view are different from the steps for entering design view for any other object.

Go to the Tools menu -> Macros -> Organize Dialogs. This takes you to the Dialogs tab of the Basic Macro Organizer. Double click newDatabase.odb. Double click the Dialogs library. Click the dlgSecondName dialog and click the Edit button. A new window opens containing dlgSecondName. Click the border of the dialog to select it. Now right click the border, and select Properties. A Properties dialog opens. To save changes, click on the Save Icon in the tool bar, select Save from the file menu, or press Ctl-s. To exit dialog design view, close the window.

N.B. You can't change a dialog's name by changing the Name property. The property will change, but the dialog's name won't. You have to make name changes in the Basic Macro Organizer, as described above.

Exporting dialogs:

Find the dlgSecondName dialog in the Basic Macro Organizer and enter design view. In the dialog design view window, above the pane containing the dialog, there are two tool bars. The lower and shorter bar has two icons, one with a plus sign, and one with a floppy disk/Save symbol. Click on the icon with the floppy disk/Save symbol. You will get a Save As dialog box giving you the option of changing the name of the file the dialog is saved to, but don't bother. Changing the file name doesn't change the name of the dialog. Just click Save.

Importing dialogs:

You're going to import the dialog you just exported. To prepare for that, go to the Basic Macro Organizer and delete the dlgSecondName dialog.

In order to import a dialog into your project file, you must already have a dialog in the file. If you don't have a dialog, you will have to create one. Think of it as a decoy dialog. It's not the dialog you want, but you need it to lure the dialog you do want into your file.

The first section of this tutorial explained how to create a dialog. As a quick review, go to the Basic Macro Organizer and click on the Dialogs tab. Find the library you want to import dialogs into. Click on that library to select it and click the New button. Accept the default name. This is just a decoy that you will delete later.

Click on the decoy dialog. Click the Edit button. This puts you in dialog design view. Under the menus, look in the second shorter toolbar and click on the icon with the plus sign. Find the dialog file that you previously exported. Click the dialog file, click the Save button, and the imported dialog will open in dialog design view.

You no longer need the decoy dialog. Reopen the Basic Macro Organizer and delete the decoy.

Cloning a dialog w/ a new name:

Some online instructions for making an exact copy of a dialog are very complicated. You're going to make it simple by exploiting a bug in LibreOffice.

Open the dlgSecondName dialog in dialog design view. Click on the border of the dialog, right click on the border, and select Properties. Change the Name property to dlgThirdName. Click outside the dialog to save the change. Now export the dialog and reimport it. The new dialog will be an exact copy of dlgSecondName, but it will be named dlgThirdName.

Reopen the original dialog in dialog design view and change the Name property back to the dialog's actual name. In this case, you used the bug intentionally and its effect was beneficial. But if the dialog continues to have a discrepancy between the dialog name and the Name property, the bug could pop up when you don't want it and do something that isn't beneficial.

N.B. The OpenOffice Basic Macro Organizer has facilities for exporting and importing libraries with their contents. These export/import facilities can't access the \\wsl.localhost part of my file system, where I keep most project files. Therefore, I've never used the library export/import facilities. OpenOffice's other dialog export/import facilities access that part of my file system just fine and are discussed in this tutorial.
NASA Mars Rover Hacking Project: Martians supplying Earth with bogus scientific data since 1997.
Post Reply