Developer   API   View

API

View

This class defines controls, which are components with visual representation.

List of all members

  • View - This class defines controls, which are components with visual representation.
  • this([name]) - Create new object.
  • invalidate([left, top, right, bottom]) - This function ensure redrawing a rectangle, determined by parameters. If no parameters are set, whole object will be redraw. Redrawing manages the function, which is set to onDraw event.
  • add(view [, order]) - Function adds existing view object into this view.
  • setFocus() - Function sets focus to the object.
  • hasFocus() - Returns true if this view has focus. Otherwise, function returns false.
  • find(name) - Search for child view, which name is same as name from function's param.
  • getChildrenBounds() - Returns four values (left, top, right, bottom) of child's union content.
  • getChildrenSize() - Returns wo values (width, height) of child's union content.
  • suspendLayout() - Pause layer's recalculating.
  • resumeLayout() - Resume layer's recalculating.
  • performLayout() - Performs (force) layout calculations.
  • detach() - Remove this view form it's parent.
  • name - Name of the object.
  • layout - StackLayout used to layout elements into the object.
  • left - X - coordinates of view's position
  • top - Y - coordinates of view's position
  • width - Width of the view (in pixels).
  • height - Height of the view (in pixels).
  • visible - Visibility of the object. True = visible (default), false = invisible
  • focusable - Ability to have a focus.
  • stretch - Gets or sets if the view's width is stretchable.
  • onProcess() - Callback function, which is which is called from the object every 25ms.
  • onDraw(sender, canvas) - This event occurs, when it is necessary to redraw object. onDraw event is usually managed by skin.
  • onKeyPressed(sender, key) - This event is raised by press the key.
  • onKeyReleased(sender, key) - This event is raised by release the key.
  • onChar(sender, charCode) - This event is raised by release an UNICODE character key.
  • onResize(sender, width, height) - Occurs when the control is resized.
  • onPointerPressed(sender, x, y) - Called when touch (click) is stared.
  • onPointerReleased(sender, x, y) - Called when touch (click) is finished.
  • onPointerDragged(sender, x, y) - Called when touch (click) is moved.

Example

// creates view object, which covers top halve of screen and fill it by red color
var view = new 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);
}