As soon as a form (containing controls) is to be presented to the user,
there is a need for an instance controlling the user interaction.
Such a FormController is responsible for dialog processing,
like controlling the tab order and the grouping of controls.
As a form may contain one or many subforms, a FormController may
contain one or more other FormController s, so the form model structure or hierarchy
is reflected in the structure of FormController s.
Responsibilities
A FormController is responsible for a ::com::sun::star::awt::UnoControlContainer ,
and all controls therein.
Furthermore, a form controller is responsible for preventing invalid user input. That is, if the form
contains controls bound to a database, or to an external validator, then the form controller will
check their current value when the current record is to be saved to the database.
First, it will check whether any controls with an external validator exist. If so, those validators
will be asked to validate the current control content. If this fails, the message provided by the validator
is displayed to the user, the control is focused, and the update of the record is vetoed.
Second, the controls are examined for NULL values. If a control is bound to a database field which
is declared to be NOT NULL
, no auto-increment field, but still NULL , then an error
message is shown to the user saying that input is required, the respective control is focused, and
the update of the record is vetoed.
Note that you can precent the second check - for database fields containing NULL values - on
a per-form and a per-database basis.
For the former, you need to add a boolean property FormsCheckRequiredFields
to the form
(aka the FormController
's model), using its
::com::sun::star::beans::XPropertyContainer::addProperty method, with a value
of false .
For the latter, you need to set the respective property of the data source's Settings
(also named FormsCheckRequiredFields
) to false .