Adding a dialog: Part I

In this multi-part article, we will be adding a dialog in a modification of our TextUtils feature. The dialog will permit the user - via radio buttons - to choose which of our functions UpperC, LowerC, or ProperC will be applied to the selected cells.

The dialog editor is invoked through the Macro Organizer. First, select Tools - Macros - Organize Macros - OpenOffice.org Basic as shown below

dlg_1.jpg

This opens the OpenOffice.org Basic Macros dialog - below. Now open the OpenOffice.org Basic Macro Organizer dialog as shown below.

dlg_2.jpg

Now select the Dialogs tab and with the Standard LIbrary of the open document selected, create a new dialog by clicking New

dlg_3.jpg

We rename the new dialog from the default to TextUtils - below.

dlg_4.jpg

We now go into the Dialog editor by clicking Edit as shown below.

dlg_5.jpg

The initial view of the Dialog Editor with the toolbox on the left and a ‘blank’ dialog on the right.

dlg_6.jpg

The dialog components (or controls) are added by first selecting the desired component type from the floating toolbox. As you move the cursor over the toolbox, each component identifies itself. For our particular example, we want to add some option buttons (or radio buttons) as we only want to have one selected at a time. Left-click to activate a component as shown below. Not the white border around the selected component.

dlg_6a.jpg

Moving the cursor into the dialog, you should see crosshairs (below)

dlg_6b.jpg

Left-click and drag to define the outline of the new control.

dlg_6c.jpg

Releaing the mouse, a new default instantiation of the control appears. The green boxes indicate the component is selected and ready for editing

dlg_6d.jpg

With the cursor inside the boundary of the new component, right-click and select Properties as shown below.

dlg_6e.jpg

The Properties dialog for each component has two tabs. We first focus on the position and appearance of the control while assigning it a meaningful identifier. We do this in the General tab. In the next part of the tutorial, we will be integrating the dialog and it’s controls with the macros we have created. This will involve the Events tab.

dlg_8.jpg

Here is the partially completed dialog - with three radio buttons and two command buttons. It may look complete - but it is not yet integrated into the document.

dlg_9.jpg

To be continued….

Leave a Reply