Dialog Controls

From Apache OpenOffice Wiki
Jump to: navigation, search

Dialog controls follow the MVC paradigm Frame-Controller-Model Paradigm in OpenOffice.org. Many attributes are offered by the control model that you would normally expect to find in the control itself. Properties like Visible or Printable are examples of typical view attributes that are available in the model.

All control models within a UNO dialog support the service com.sun.star.awt.UnoControlModel, that includes com.sun.star.awt.UnoControlDialogElement, as described in Setting Dialog Properties. It exports the interfaces com.sun.star.beans.XPropertySet and com.sun.star.beans.XMultiPropertySet. When you set multiple properties at the same time you should use [IDL:com.sun.star.beans.XMultiPropertySet] because then multiple properties can be set with a single API call. When you use com.sun.star.beans.XMultiPropertySet make sure you pass the properties in alphabetical order. All relevant properties may be set directly in the control model. Some controls offer similar functionality, but by default you should always work in the control model.

The coding examples in the following sections concentrate on control models as the default.

Controls are required to:

  • Attach listeners.
  • Get Window or device dependent information.
  • Use the "convenience" functionality offered by list boxes.
  • Adjust the size according to the content. The interface com.sun.star.awt.XLayoutConstrains offers methods like getPreferredSize() that can be helpful when the size of the control is to be adjusted to its content. You must remember that the Unit of the returned size is according to the specification in com.sun.star.awt.Size in 1/100th mm. This size may be applied with setSize() at the control.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages