Properties

From Apache OpenOffice Wiki
< Documentation‎ | BASIC Guide
Revision as of 13:46, 11 September 2010 by Ottoshmidt (Talk | contribs)

Jump to: navigation, search


Name and Title

Every control element has its own name that can be queried using the following model property:

Model.Name (String)
control element name

You can specify the title that appears in the title bar of a dialog with the following model property:

Model.Title (String)
dialog title (only applies to dialogs)

Position and Size

You can query the size and position of a control element using the following properties of the model object:

Model.Height (long)
height of control element (in ma units)
Model.Width (long)
width of control element (in ma units)
Model.PositionX (long)
X-position of control element, measured from the left inner edge of the dialog (in ma units)
Model.PositionY (long)
Y-position of control element, measured from top inner edge of the dialog (in ma units)

To ensure platform independence for the appearance of dialogs, Apache OpenOffice uses the Map AppFont (ma) internal unit to specify the position and size within dialogs. An ma unit is defined as being one eighth of the average height of a character from the system font defined in the operating system and one quarter of its width. By using ma units, Apache OpenOffice ensures that a dialog looks the same on different systems under different system settings.

If you want to change the size or position of control elements for runtime, determine the total size of the dialog and adjust the values for the control elements to the corresponding part ratios.

Template:Documentation/Note

Focus and Tabulator Sequence

You can navigate through the control elements in any dialog by pressing the Tab key. The following properties are available in this context in the control elements model:

Model.Enabled (Boolean)
activates the control element
Model.Tabstop (Boolean)
allows the control element to be reached through the Tab key
Model.TabIndex (Long)
position of control element in the order of activation

Finally, the control element provides a setFocus method that ensures that the underlying control element receives the focus:

setFocus
control element receives the focus (only for dialogs)

Multi-Page Dialogs

A dialog in Apache OpenOffice can have more than one tab page. The Step property of a dialog defines the current tab page of the dialog whereas the Step property for a control element specifies the tab page where the control element is to be displayed.

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 regardless of their Step value. Similarly, if you set this value to zero for a control element, the element is displayed on all of the tab pages in a dialog.

Designing Page 1 of the dialog

In the preceding example, you can also assign the Step value of 0 to the dividing line as well as the Cancel, Prev, Next, and Done buttons to display these elements on all pages. You can also assign the elements to an individual tab page (for example page 1).

The following program code shows how the Step value in event handlers of the Next and Prev buttons can be increased or reduced and changes the status of the buttons.

Sub cmdNext_Initiated
 
   Dim cmdNext As Object
   Dim cmdPrev As Object
 
   cmdPrev = Dlg.getControl("cmdPrev")
   cmdNext = Dlg.getControl("cmdNext")
   cmdPrev.Model.Enabled = Not cmdPrev.Model.Enabled
   cmdNext.Model.Enabled = False
   Dlg.Model.Step = Dlg.Model.Step + 1
 
End Sub
 
Sub cmdPrev_Initiated
 
   Dim cmdNext As Object
   Dim cmdPrev As Object
 
   cmdPrev = Dlg.getControl("cmdPrev")
   cmdNext = Dlg.getControl("cmdNext")
   cmdPrev.Model.Enabled = False
   cmdNext.Model.Enabled = True
   Dlg.Model.Step = Dlg.Model.Step - 1
 
End Sub

A global Dlg variable that references an open dialog must be included to make this example possible. The dialog then changes its appearance as follows:

Page 1
Page 2

Template:Documentation/Tip


Dialogs supporting several languages

The strings of a Dialog can be localized, see the Developer's Guide chapter Dialog Localization.


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