Application Form
It is up to application requirements how the application form should look like and what elements should it contain. Application form pattern could contain title bar, body (content) and toolbar.
Form body can be various; depending on the kind of application. There are three basic types of application form content:
- Read only
- Updateable
- List
Read only content does not have any input elements. It just displays information on the screen. It is usually used for details page.
Updateable content contains input element and update action is fired by application button or toolbar button. There are various update fields -e.g. text field, date field or check boxes.
List displays information of the same kind. For example - books, dvd, contact persons, etc. Usually, list content does not fit at the device screen, therefore it is scrollable and paging is also available for this content.
Moscrif application form defines what the form is supposed to do - onActivate or onDeactivate. These methods are called by application at the time when form is going to be displayed or going to be replaced by other form.
Form elements are added via add() method.
Example below shows how to create simple form with title bar, tool bar and how to define a keyboard.
app.onStart = function(sender)
{
//define a form instance
this.form = new Form(); //define tile bar
this.form.add(new TitleBar(null,"Title")); //define tool bar
var tool = new ToolBar();
this.form.add(tool); var checkButton = new ToolBarButton("", #check, "");
checkButton.onClick = function()
{
app.processData();
}
tool.add(checkButton); // create keyboard
this.keyboard = new Keyboard(); // hide keyboard by default
this.keyboard.native.visible = false;
this.keyboard.onKey = function (sender, ch)
{
app.activeEditor.acceptKey(ch);
}
this.form.add(this.keyboard); //add form to application
app.add(this.form);
}