Win an Ipad
  Developer   Documents   View

View

This article describes basic UI element of Moscrif.

View

is basic Moscrif element (container). It contains other objects that are going to be rendered on the device screen or it carries other elements to be rendered.

View has basic properties - such as visible - to set if element is rendered or not. Size attributes (width and height) define position on the screen.

//creates view object,
//which covers top halve of screen and fill it by red color
var view = new Moscrif.View();
view.visible = true;
view.width = System.width;
view.height = System.height / 2;
view.top = 0;
view.left = 0;
view.onDraw = function (sender, canvas) { canvas.clear(0xffff0000); }

 

Most important events of View are onProcess and onDraw. These methods are performed in the cycle (see Application cycle) and executed for each child element in view. To add child to view, use add method.

 

View handle all events regarding user inputs, like tap on the screen or key pressed. Find all supported events in the table below :


onChar onPointerDragged
onKeyPressed onPointerPressed
onKeyReleased onPointerReleased

 

View defines property layout as well and properties performLayout, resumeLayout. Layout is an instance of StackLayout class. It defines how the View (element) is rendered on the screen.

 Socket stream   View   ScrollView 
Write a Comment (0)
Subject
Please complete this mandatory field.
HTML Tags Not Allowed!
Comment
Please complete this mandatory field.