Developer   API   User Interface   Control   TextBox

  •  Config(0)
  •  Properties(36)
  •  Methods(25)
  •  Events(10)

TextBox : ScrollContainer

TextBox definition, to insert characters. Once TextBox is active, onFocus application keybord is show. Keybord can be system as well but it depends to platform and application settings.

Example

include "lib://uix-skin/metro/skin.metro.ms" include "lib://uix/application.ms" include "lib://uix/form.ms" include "lib://uix/control/textBox.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 textBox var textBox = new TextBox({hint : "name"}); // onFocusChanged event textBox.onFocusChanged = function(sender, gainFocus/*true - has focus/false - has not focus*/) { // text typed in textBox logI(this.value); } form.add(textBox); } 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

  • autoKeyboard : Boolean
    If this flag is true, the keyboard will appear automatically when user clicks to the text box.
  • autoSize : Symbol
    Gets or sets auto-size flag of this TextView.
  • 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.
  • cursor : Drawing
    Cursor drawing property.
  • defaults : Object
    Sets default controls options.
  • editor : TextView
    Instance of TextView.
  • fg : TextDrawing
    Foreground drawing, it holds instance of TextDrawing object to decorate text of Control.
  • fgPressed : TextDrawing
  • focusable : Boolean
    Focusable property.True - focus is allowed, false - focus is permitted.
  • height : Integer
    Height of the object (in pixels).
  • hint : String
    Property Hint.
  • horzAlign : Symbol
    Property for horizontal align.
  • inactive : Drawing
    Drawing of Inactive state of textBox.
  • initialisation : Boolean
    Initialisation in progress.
  • layout : StackLayout
    StackLayout used to layout elements into the object.
  • left : Integer
    X - coordinates of Control's position.
  • marginX : Integer
    Margin X.
  • marginY : Integer
    Margin Y.
  • mode : Symbol
    Insertion mode. See TextBox Mode
  • multiLine : Boolean
    Multiline property. False text box single line only.
  • 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)
  • readOnly : Boolean
    Read only property.
  • scrollMode : Symbol
    Scroll Mode of Scroll View.
  • 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.
  • this
    Construct of the object calls following method in order.
  • top : Integer
    Y - coordinates of control's position.
  • value : String
    Value property of textbox.
  • vertAlign : Symbol
    Property for vertical align.
  • visible : Boolean
    Visibility of the Control. Default is True.
  • width : Integer
    Width of the object (in pixels).

Methods

  • acceptKey(key)
    Accept key function.
  • 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.
  • doFocusChanged(sender, gainFocus)
    Event focus changed.
  • find(name) : Control
    Search for child Controls, which name is same as name from function's param.
  • 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
    Check if textBox has focus.
  • 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.
  • initControls()
    Init TextBox controls.
  • invalidate()
    Invalidate of curent textBox. TextBox will be redrawen.
  • onChanged(sender) : Function
    On changed event (is called when user changes text in the box)
  • onFocusChanged(sender,gainFocus) : Function
    On focus changed event.
  • performLayout()
    Performs (force) layout calculations.
  • processKey(key)
    Precess key function.
  • removeAll()
    Remove all child controls from container.
  • resumeLayout()
    Resume layer's recalculating.
  • setFocus()
    Set focus to current textBox.
  • 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.
  • onCursorChanged(sender, pos, line, char)
    Event on focus changed.
  • 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,w,h)
    On resize event.
API Navigation