21.08.2013 Views

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

OpenOffice.org BASIC Guide - OpenOffice.org wiki

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Multi-Page Dialogs<br />

Properties<br />

A dialog in <strong>OpenOffice</strong>.<strong>org</strong> can have more than one tab page. The Step property of a dialog defines the current<br />

tab page of the dialog whereas the Step property for a control element specifies the tab page where the control<br />

element is to be displayed.<br />

The Step-value of 0 is a special case. If you set this value to zero in a dialog, all of the control elements are visible<br />

regardless of their Step value. Similarly, if you set this value to zero for a control element, the element is<br />

displayed on all of the tab pages in a dialog.<br />

Designing Page 1 of the dialog<br />

In the preceding example, you can also assign the Step value of 0 to the dividing line as well as the Cancel,<br />

Prev, Next, and Done buttons to display these elements on all pages. You can also assign the elements to an<br />

individual tab page (for example page 1).<br />

The following program code shows how the Step value in event handlers of the Next and Prev buttons can be<br />

increased or reduced and changes the status of the buttons.<br />

Sub cmdNext_Initiated<br />

Dim cmdNext As Object<br />

Dim cmdPrev As Object<br />

cmdPrev = Dlg.getControl("cmdPrev")<br />

cmdNext = Dlg.getControl("cmdNext")<br />

cmdPrev.Model.Enabled = Not cmdPrev.Model.Enabled<br />

cmdNext.Model.Enabled = False<br />

Dlg.Model.Step = Dlg.Model.Step + 1<br />

End Sub<br />

Sub cmdPrev_Initiated<br />

Dim cmdNext As Object<br />

Dim cmdPrev As Object<br />

cmdPrev = Dlg.getControl("cmdPrev")<br />

cmdNext = Dlg.getControl("cmdNext")<br />

cmdPrev.Model.Enabled = False<br />

cmdNext.Model.Enabled = True<br />

Dlg.Model.Step = Dlg.Model.Step - 1<br />

End Sub<br />

A global Dlg variable that references an open dialog must be included to make this example possible. The dialog<br />

then changes its appearance as follows:<br />

Chapter 11 · Dialogs 155

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!