You are here: FlexForm Widget > FlexForm Widget Basics > Example and Sample App

Example and Sample App

In this section, you can find information on some sample applications and an example on how to use FlexForm widget.

To download a sample app to view the animations, click here.

To view the various capabilities of the FlexForm, download the Events app from here.

Following is a sample code for creating a FlexForm with a Label widget.


//Defining the properties of FlexForm
function testForm_preshow(eventobject) {
 kony.print("Test Form Preshow event");
}

function testForm_postshow(eventobject) {
 kony.print("Test Form Postshow event");
}

function testForm_onhide(eventobject) {
 kony.print("Test Form onHide event");
}

function testForm_onDestroy(eventobject) {
 kony.print("Test Form onDestroy event");
}

function testForm_onScrollStart(eventobject) {
 kony.print("Test Form onScrollStart event");
}

function testForm_onScrollEnd(eventobject) {
 kony.print("Test Form onScrollEnd event");
}

function testForm_onScrollTouchReleased(eventobject) {
 kony.print("Test Form onScrollTouchReleased event");
}

function testForm_onScrolling(eventobject) {
 kony.print("Test Form onScrolling event");
}

function testForm_onDecelerationStarted(eventobject) {
 kony.print("Test Form onDecelerationStarted event");
}

function testForm_onTouchStart(eventobject, x, y) {
 kony.print("Test Form onTouchStart event");
}

function testForm_onTouchEnd(eventobject, x, y) {
 kony.print("Test Form onTouchEnd event");
}

function testForm_onTouchMove(eventobject, x, y) {
 kony.print("Test Form onTouchMove event");
}

function testForm_onZoomStart(eventobject, widget) {
 kony.print("Test Form onZoomStart event");
}

function testForm_onZoomEnd(eventobject, widget) {
 kony.print("Test Form onZoomEnd event");
}

function testForm_onZooming(eventobject, widget) {
 kony.print("Test Form onZooming event");
}

function testForm_onOrientationChange(eventobject) {
 kony.print("Test Form onOrientationChange event");
}

function addWidgetstestForm() {
 var myLabel = new kony.ui.Label({
  "id": "myLabel",
  "isVisible": true,
  "centerX": "50%",
  "centerY": "50%",
  "skin": "myLabelSkin",
  "text": "Test Form",
  "textStyle": {
   "letterSpacing": 0,
   "strikeThrough": false
  },
  "width": kony.flex.USE_PREFFERED_SIZE,
  "zIndex": 1
 }, {
  "contentAlignment": constants.CONTENT_ALIGN_MIDDLE_RIGHT,
  "padding": [0, 0, 0, 0],
  "paddingInPixel": false
 }, {
  "textCopyable": false
 });
 testForm.add(myLabel);
}
function openingTestForm() {
 testForm = new kony.ui.Form2({
  "id": "testForm",
  "width": "390dp",
  "height": "386dp",
  "contentOffset": {
   "x": "3dp",
   "y": "4dp"
  },
  "contentSize": {
   "width": "5dp",
   "height": "6dp"
  },
  "enableScrolling": true,
  "bounces": true,
  "allowHorizontalBounce": true,
  "allowVerticalBounce": false,
  "pagingEnabled": true,
  "title": "myfrmt",
  "needAppMenu": true,
  "enabledForIdleTimeout": true,
  "skin": "formSkin",
  "preShow": testForm_preshow,
  "postShow": testForm_postshow,
  "onHide": testForm_onhide,
  "onDestroy": testForm_onDestroy,
  "onScrollStart": testForm_onScrollStart,
  "onScrollEnd": testForm_onScrollEnd,
  "onScrollTouchReleased": testForm_onScrollTouchReleased,
  "onScrolling": testForm_onScrolling,
  "onDecelerationStarted": testForm_onDecelerationStarted,
  "onTouchStart": testForm_onTouchStart,
  "onTouchEnd": testForm_onTouchEnd,
  "onTouchMove": testForm_onTouchMove,
  "zoomScale": 22,
  "minZoomScale": 1.0,
  "maxZoomScale": 1.0,
  "onZoomStart": testForm_onZoomStart,
  "onZoomEnd": testForm_onZoomEnd,
  "onZooming": testForm_onZooming,
  "onOrientationChange": testForm_onOrientationChange,
  "layoutType": kony.flex.FREE_FORM,
  "addWidgets": addWidgetstestForm
 }, {
  "padding": [0, 0, 0, 0],
  "displayOrientation": constants.FORM_DISPLAY_ORIENTATION_PORTRAIT,
  "paddingInPixel": false
 }, {
  "retainScrollPosition": true,
  "needsIndicatorDuringPostShow": true,
  "formTransparencyDuringPostShow": "100",
  "inputAccessoryViewType": constants.FORM_INPUTACCESSORYVIEW_DEFAULT,
  "bouncesZoom": false,
  "configureExtendTop": true,
  "configureExtendBottom": false,
  "configureStatusBarStyle": false,
  "extendTop": false,
  "titleBar": true,
  "footerOverlap": false,
  "headerOverlap": false,
  "inTransitionConfig": {
   "transitionDirection": "fromLeft",
   "transitionEffect": "none"
  },
  "outTransitionConfig": {
   "transitionDirection": "fromRight",
   "transitionEffect": "none"
  }
 });
 testForm.setDefaultUnit(kony.flex.PX);
 testForm.show();
}

prem Copyright © 2012 Kony, Inc. All rights reserved.
prem Copyright © 2012 Kony, Inc. All rights reserved.