Eigenschappen

From Apache OpenOffice Wiki
< NL‎ | Documentation‎ | BASIC Guide
Revision as of 13:40, 17 March 2013 by DiGro (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Book.png


Naam en titel

Elk besturingselement heeft zijn eigen naam die kan worden bevraagd met behulp van de volgende eigenschap van Model:

Model.Name (String)
naam besturingselement

U kunt de titel specificeren die in de titelbalk van een dialoogvenster verschijnt met de volgende eigenschap van het model:

Model.Title (String)
titel dialoogvenster (alleen van toepassing in dialoogvensters)

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