Developer   API   User Interface   Control   CheckBox

  •  Config(0)
  •  Properties(34)
  •  Methods(22)
  •  Events(10)

CheckBox : Button

Check box Control. IT has two states, checked and unchecked. To visualise check box, Moscrif use box pattern. It hase on and off drawing properies, which can be customalised per project in skin theme file.

Example

include "lib://uix-skin/metro/skin.metro.ms" include "lib://uix/application.ms" include "lib://uix/form.ms" include "lib://uix/control/checkBox.ms" var app = new Application({skin: new MetroSkin()}); var quit = false; app.onStart = function(sender) { var form = new Form(); app.add(form); // TODO: to example // create check box (by default unchecked) var checkBox = new CheckBox({text : "check box text"}); // onClick event checkBox.onClick = function(s) { // true if box is checked, otherwise false logI(this.checked); } form.add(checkBox); // create checked check box var checkBoxB = new CheckBox({text : "checked check box", checked : true}); checkBoxB.onClick = function(s) { logI(this.checked); } form.add(checkBoxB); } app.onProcess = function(sender) { return quit ? 0 : 1; } app.onKeyPressed = function(sender, key) { quit = true; } app.onDraw = function(sender, canvas) { canvas.clear(0xffdadada); } app.init().run();

Properties

  • align : Symbol
    Align of button components.
  • bg : BGDrawing
    Background drawing, it holds instance of BGDrawing to decorate background.
  • bgPressed : BGDrawing
  • border : Drawing
    Border drawing, it holds instance of Drawing to decorate border.
  • box : BoxDrawing
    Box Pattern, it keeps on and off drawing of check box.
  • boxAlign : Symbol
    Box Align.
  • checked : Boolean
    Checked flag.
  • clicked : Boolean
    Clicked flag.
  • clipToBounds : Boolean
    Set/Get if the view is not clipped to its bounds.
  • defaults : Object
    Sets default controls options.
  • detach : UIX.View
    Remove this view form it's parent.
  • disabled : Pattern
    Disabled pattern property, it defines what drawing is used when Button is disabled. Pattern specify Foreground, bacgkround and border paints
  • enabled : Boolean
    Flag to enable/disable Button.
  • fg : TextDrawing
    Foreground drawing, it holds instance of TextDrawing object to decorate text of Control.
  • fgPressed : TextDrawing
  • height : Integer
    Height of the Control (in pixels).
  • image : Image
    Image property, to set bitmap or vector picture to the Button.
  • initialisation : Boolean
    Initialisation in progress.
  • label : Label
    Button Label definition.
  • layout : StackLayout
    StackLayout used to layout elements into the object.
  • left : Integer
    X - coordinates of Control's position.
  • name : String
    Name of the Control.
  • native : Any
    Native, instance of native UI object(View,ScrollView,Window).
  • options : Object
    Position of navigation bar.
  • parent : Any
    Parent, instance of native UI object where current Control is assigned. Basicaly is a container where control was added.(View,ScrollView,>Window)
  • pressed : Pattern
    Pressed pattern property, it defines what drawing is used when Button is clicked. Pattern specify Foreground, bacgkround and border paints
  • skipDrawing : Boolean
    Skip control drawing. It used if control is part of composite control what manage drawing bu itself.
  • stretch : Symbol
    Gets or sets if the view's width is stretchable.
  • text : String
    Text property.
  • textAlign : Object
    Text Align.
  • this
    Construct of the object calls following method in order.
  • top : Integer
    Y - coordinates of control's position.
  • visible : Boolean
    Visibility of the Control. Default is True.
  • width : Integer
    Width of the Control (in pixels).

Methods

  • add(control,order = #front)
    Add Control to container.
  • afterInit()
    After Init Control, set control defaults from current theme setting.
  • afterInitControls
    Method is executed after init controls.
  • beforeInit()
    After Init Control, set control defaults from current theme setting.
  • beforeInitControls
    Method is executed before init controls.
  • find(name) : Control
    Search for child Controls, which name is same as name from function's param.
  • focusable() : Boolean
    Ability to have a focus.
  • getChildrenBounds() : MultiValue
    Returns four values (left, top, right, bottom) of child's union content.
  • getChildrenSize() : MultiValue
    Returns two values (width, height) of child's union content.
  • hasFocus() : Boolean
    Returns true if this Control has focus. Otherwise, function returns false.
  • icon(width, height) : Control
    Icon, other way how o set control image. It accept symbol of vector, location to bitmap, instance of bitmap or instance of path. This property can be used only if image is defined.
  • init()
    Init Check Box Control.
  • invalidate()
    This function ensure redrawing a rectangle, determined by parameters. Redrawing manages the function, which is set to onDraw event.
  • isImage() : Boolean
    Is image test. Return true if image instance is set
  • performLayout()
    Performs (force) layout calculations.
  • removeAll()
    Remove all child controls from container.
  • resumeLayout()
    Resume layer's recalculating.
  • setFocus() : Control
    Function sets focus to the Control.
  • setLocation(left, top) : Control
    Function to set control left and top position.
  • setSize(width, height) : Control
    Function to set width and hight of control.
  • suspendLayout()
    Pause layer's recalculating.
  • undefined(k,v)
    Special property executed when priperty is undefined. It can be that JSON format is in format "key" : "value". Key is an string, so if this is the case methot return "value". Ass well as k is a regular property of the class it returns getter of this property.

Events

  • onChar(sender,charCode) : Function
    This event is raised by release an UNICODE character key.
  • onClick(sender) : Function
    On click event.
  • onDraw(sender,canvas) : Function
    This event occurs, when it is necessary to redraw object. onDraw event is usually managed by skin.
  • onKeyPressed(sender,key) : Function
    This event is raised by press the key.
  • onKeyReleased(sender,key) : Function
    This event is raised by release the key.
  • onPointerDragged(sender,x,y) : Function
    Called when touch (click) is moved.
  • onPointerPressed(sender,x,y) : Fucntion
    Called when touch (click) is stared.
  • onPointerReleased(sender,x,y) : Function
    Called when touch (click) is finished.
  • onProcess : Function
    Callback function, which is called from the object every 25ms.
  • onResize(sender,charCode) : Function
    Occurs when the control is resized.
API Navigation