Adding a dialog: Part I

Thursday, September 8th, 2005

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, orProperC will be applied to the selected cells.

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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.

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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

Adding a dialog: Part I - student2.ru

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.

Adding a dialog: Part I - student2.ru

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.

Adding a dialog: Part I - student2.ru

To be continued….

Posted in OpenOffice Basic | No Comments »

Наши рекомендации