Dialog as Control Container

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 09:55, 22 October 2009 by BMarcelly (Talk | contribs)

Jump to: navigation, search



All controls belonging to a dialog are grouped together logically. This hierarchy concept is reflected by the fact that a dialog control is a container for other controls. The corresponding service com.sun.star.awt.UnoControlDialog therefore supports the com.sun.star.awt.XControlContainer interface that offers container functionality, namely access to its elements by name. Since in OpenOffice.org Basic, every method of every supported interface is called directly at the object without querying for the appropriate interface, a control with the name TextField1 can be obtained from a dialog object oDialog simply by:

  oControl = oDialog.getControl("TextField1")

See OpenOffice.org Basic for additional information. The hierarchy between a dialog and its controls can be seen in the dialog model com.sun.star.awt.UnoControlDialogModel, which is a container for control models and therefore supports the com.sun.star.container.XNameContainer interface. A control model is obtained from a dialog model by:

  oDialogModel = oDialog.getModel()
  oControlModel = oDialogModel.getByName("TextField1")

or shorter

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