21.08.2013 Views

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

OpenOffice.org BASIC Guide.pdf - OpenOffice.org wiki

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Working With Dialogs 211<br />

Closing With the Close Button in the Title Bar<br />

You can close a dialog by clicking the close button on the title bar of the dialog window. The<br />

Execute method of the dialog returns the value 0, which is the same as when you click<br />

Cancel.<br />

Closing With an Explicit Program Call<br />

You can also close an open dialog window with the endExecute method:<br />

Dlg.endExecute()<br />

Access to Individual Control Elements<br />

A dialog can contain any number of control elements. You can access these elements<br />

through the getControl method that returns the control element by name.<br />

Dim Ctl As Object<br />

Ctl = Dlg.getControl("MyButton")<br />

Ctl.Label = "New Label"<br />

This code determines the object for the MyButton control element and then initializes the<br />

Ctl object variable with a reference to the element. Finally the code sets the Label property<br />

of the control element to the New Label value.<br />

Unlike <strong>OpenOffice</strong>.<strong>org</strong> Basic identifiers, the names of control elements are case sensitive.<br />

Working With the Model of Dialogs and Control Elements<br />

The division between visible program elements (View) and the data or documents behind<br />

them (Model) occurs at many places in <strong>OpenOffice</strong>.<strong>org</strong> API. In addition to the methods and<br />

properties of control elements, both dialog and control element objects have a subordinate<br />

Model object. This object allows you to directly access the content of a dialog or control<br />

element.<br />

In dialogs, the distinction between data and depiction is not always as clear as in other API<br />

areas of <strong>OpenOffice</strong>.<strong>org</strong>. Elements of the API are available through both the View and the<br />

Model.<br />

The Model property provides program-controlled access to the model of dialog and control<br />

element objects.<br />

Dim cmdNext As Object

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

Saved successfully!

Ooh no, something went wrong!