Forms

A form is a specific kind of selection list, where all items (fields) have some editable content.

A form can be in the View state or in the Edit state. The item layouts and functionality are different in these states:

  • In the View state, the items are not editable. The form functions and looks are similar to selection list. Items can be selected to perform an application-specific function.

  • In the Edit state, the user can edit all the fields. Forms can contain text fields (alphanumeric or numeric content), pop-up fields and sliders.

The user can switch from the View state to the Edit state using the Edit command in the Options menu. In the Edit state, the contents of the form can be accepted using the right softkey labeled as Done. The form then returns to the View state.

Using forms in applications

The API to use for creating forms is the Form API. For more information, see Symbian C++ API specifications.

Typically, a form will be derived from the class CAknForm and the methods CAknForm::SaveFormDataL() and CAknForm::DoNotSaveFormData() will be implemented by the developer. These are called when users switch from edit mode to view mode and are prompted by the form as to whether they wish to save their modifications.

For customization, the class CAknForm provides a single-line or double-line layout and it is possible to use icons on forms.

In the following example, the form is pushed on the cleanup stack before CAknForm:: ConstructL() (a potentially leaving method) is called, and popped off before CAknDialog:: ExecuteLD().

CAknExFormAdd* form = new(ELeave) CAknExFormAdd;
CleanupStack::PushL(form);
form->ConstructL();
CleanupStack::Pop();
form->ExecuteLD(R_AKNEXFORM_TEXT_FIELD_DIALOG);