Creating Dialogs

From Apache OpenOffice Wiki
Jump to: navigation, search

To create a dialog in the Basic IDE, right-click the Module1 tab at the bottom of the Basic source editor and select Insert > Basic Dialog. The IDE creates a new page named Dialog1:

The Basic GUI Editor
Controls.png To add controls to the dialog, we require the dialog design tools. Click the Controls icon to pop up the design tools window. The title bar of the tools window can be used to drag the window away from the toolbar to keep it open permanently.

Our dialog shall offer a more convenient way to select a file than the simple input box of our first example. Furthermore, the user shall be able to control how the picture is anchored in the text after inserting it. For this, we will create a wizard dialog with two steps.

FileSelection.png In the design tools window, select File Selection and define the size of the Browse control by dragging a rectangle in the dialog using the left-mouse button.
ControlProperties.png The Properties icon displays the Properties Dialog that is used to edit controls and hook up event handling code to events occurring at dialog controls.
ButtonControl.png Next, add << Back and Next >> Buttons to move between the dialog steps, and a Finish and Cancel button. Select the Button icon and define the button size using the left-mouse button. Buttons are labeled with a default text, such as CommandButton1. If the Properties Dialog is not open, double click the newly inserted button controls to display it. Enter new labels in the Label field as suggested, and name the dialog step buttons Back and Next. Set the property Enabled for the << Back button to false.
LabelControl.png Use the Label tool to create a label "Select Graphics File:" in the same manner.

Now the dialog looks similar to the illustration below:

The custom dialog
ActivateTestMode.png Test the dialog using the Activate Test Mode icon from the design tool window. After you have finished the test, click the Close button of the test dialog window.

To edit the dialog, such as setting the title and changing the size, select it by clicking the outer border of the dialog. Green handles appear around the dialog. The green handles can be used to alter the dialog size. The Properties Dialog is used to define a dialog title and other dialog properties.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages