The point-and-click philosophy of LavaPE implies in particular that a few mouse-clicks suffice to produce a default form representation from a given class declaration. This automatic mapping is governed by the following simple principles some of which have not yet been implemented (NYI) so far, however:
The representation of an elementary data field depends on the type of the corresponding member variable:
You can generate a default form representation GUI_of_XY of an existing class XY with a single mouse-click:
Note: If class XY has a member of some class Z then a GUI service class and implementation is generated also for class Z if none existed so far (or one is selected if Z has a GUI service already). Or more generally: GUI service classes are generated recursively where required, or selected from the existing ones. (This selection can be modified afterwards.)
The context menu, either on an input field in the form view (left pane), or in the form structure tree (upper half of right pane) allows you to add a new handler to the field or to attach an appropriate existing handler to it. (On text edit fields you must proceed to the "Lava" sub-menu of the context menu.)
The handler function is created as a member function of the respective GUI service implementation. The function property dialog expects you to select a GUI event type to be handled. For input fields, Lava provides presently only one GUI event type "New value", which is signaled when a new value has been entered in an input field. Lava passes the original value and the newly entered value as input parameters to the handler. The handler may pass a modified value to its (optional) output parameter.
If a Lava class XY contains an optional member variable optvar then it ill be represented by a push button in the corresponding form representation of XY. It can be pushed to insert the form representation of optvar in place of the button. On the push button, as well as on the form representation, you can invoke the context menu to assign a handler to the "Insert/delete optional" event, which is signaled when you attempt to insert or delete an optional item.
Likewise, Lava classes that are derived from the Lava Chain class provide "Insert/delete chain element" events, which are signaled when you attempt to insert or delete a chain element. Again you may control by corresponding handlers whether the insert/delete operation is accepted, and in the insert case you may optionally return the element to be inserted to the Lava run time system (or else default initialization, see above, will be applied to the element).
More than one GUI event handler may be attached to the same input field, optional or chain element. Typically this is used to provide specialized behaviour in specialized contexts:
For instance, assume fld is an input field in GUI service F_XY and F_XY is in turn used as a sub-form in GUI service F_Z. Then you may attach a "New value" handler to fld in F_XY and another one in F_Z. The latter will be used whenever fld is used in the F_Z context, the former whenever F_XY is the top level GUI service or the "parent" GUI service doesn't have a "New value" handler for fld. The Lava run time system will always invoke the uppermost handler in the form/sub-form hierarchy if several handlers exist for an input field, optional or chain element, i.e., the handler belonging to the most special usage context.
Every GUI class contains two member functions FillOut and Edit that can be called in order to present the form representation F_XY of an object xy of type XY. Before you can call FillOut and Edit you must create an object f_xy of type F_XY. The object xy serves as input parameter to FillOut and Edit.
FillOut first generates a copy of xy. this copy is presented to the user. The copy may be modified by the user then. Clicking the OK button terminates the editing process and FillOut passes the modified copy through its output parameter to the caller.
You can use FillOut also to present and fill out an empty form: Simply pass the input parameter "Ø" (the "null" object") to FillOut ("empty input form").
Edit presents its input object xy directly to the user (rather than a copy of it) and allows the user to edit it "in place", provided xy is a state object.
Summary: FillOut uses its input parameter, which is a value object, as a template for the initialization of a separate output object which may be modified by the user after initialization and which is returned finally as an output parameter. Edit accepts a state object as input parameter and enables you to modify it "in place". Both FillOut and Edit are terminated by clicking the OK button.
In contrast to this FillOut andEdit mechanism, persistent Lava component objects may be edited "directly" without explicit invocation of a forms editing method (but using the same kind of Lava GUI services as FillOut and Edit).
our form sample and the Lava component object samples.