Moscrif API Docs for: 2012q3
Show:

Moscrif.TextView Class

Library: ui

This class implements text viewer and text editor.

Methods

this

(
  • [name=null]
)
TextView

Create new TextView object.

Parameters:

  • [name=null] String optional

    Name of the object. Pass null for unnamed control.

Returns:

TextView:

detach

()

Remove object from superior view object (application, form etc).

hasFocus

() Boolean

Returns true if TextView has focus. Otherwise, function returns false.

Returns:

insert

(
  • char
)

Insert char into text view.

Parameters:

  • char Integer

    (Uni)code of char to be inserted.

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.

Parameters:

  • [left] Boolean optional

    Left border of the rectangle to be invalidated.

  • [top] Boolean optional

    Top border of the rectangle to be invalidated.

  • [right] Boolean optional

    Right border of the rectangle to be invalidated.

  • [bottom] Boolean optional

    Bottom border of the rectangle to be invalidated.

replace

(
  • key
)

Replace char at current position in TextView by new char.

Parameters:

  • key Integer

    (Uni)code of new char to be replaced.

replace

()

Backspace function removes char at the current position. This function is usually used as a reaction on backspace key.

setFocus

() Boolean

Function sets focus to the TextView object.

Returns:

Properties

autoSize

Symbol

Gets or sets auto-size flag of this TextView:

  • #fixed
  • #width
  • #height

cursor

Multivalue

Gets position pair (line, char).

cursorPos

Integer

Cursor position in text (from the beginning).

cursorRect

Multivalue

Four values (left, top, right, bottom), represents cursor position and size.

focusable

Boolean

Ability to have a focus.

height

Integer

Height of the object (in pixels).

horzAlign

Symbol

Determines horizontal text position.

  • #left
  • #center
  • #right

left

Integer

X - coordinates of the TextView's location.

marginX

Integer

Width of the left and right margin.

marginY

Integer

Width of the top and bottom margin.

multiLine

Boolean

Gets or sets multi-line flags of this TextView.

name

String

Name of the TextView object.

paint

Paint

Paint object used to draw text inside the object. Thanks to this property, developer can set text size, color, font etc.

readOnly

Boolean

Gets or sets read-only flags of this TextView.

stretch

Symbol

Gets or sets if the view's width is stretchable. * #hor * #vert * #both

text

String

Text in the object.

top

Integer

Y - coordinates of the TextView's location.

visible

Boolean

Visibility of the object. True = visible, false = invisible

width

Integer

Width of the object (in pixels).

Events

doCursorKey

Sends request of cursor key to TextView.

Event Payload:

  • key Symbol

    Key symbols:

    • #leftSoftKey
    • #rightSoftKey
    • #home
    • #back
    • #send
    • #end
    • #num0 - #num9
    • #star - the * key
    • #hash - the # key
    • #up
    • #down
    • #left
    • #right
    • #ok
    • #volumeUp
    • #volumeDown
    • #power
    • #camera

onChar

This event is raised by release an UNICODE character key.

Event Payload:

  • sender Object

    Object which caused this event.

  • key Integer

    Code from unicode table.

onDraw

This event occurs, when it is necessary to redraw object.

Event Payload:

  • sender Object

    Object which caused this event.

  • canvas Canvas

    Canvas object enabling drawing to the TextView.

onKeyPressed

This event is raised by press the key.

Event Payload:

  • sender Object

    Object which caused this event.

  • key Symbol

    Pressed key.

    • #leftSoftKey
    • #rightSoftKey
    • #home
    • #back
    • #send
    • #end
    • #num0 - #num9
    • #star - the * key
    • #hash - the # key
    • #up
    • #down
    • #left
    • #right
    • #ok
    • #volumeUp
    • #volumeDown
    • #power
    • #camera

onKeyReleased

This event is raised by release the key.

Event Payload:

  • sender Object

    Object which caused this event.

  • key Symbol

    Pressed key.

    • #leftSoftKey
    • #rightSoftKey
    • #home
    • #back
    • #send
    • #end
    • #num0 - #num9
    • #star - the * key
    • #hash - the # key
    • #up
    • #down
    • #left
    • #right
    • #ok
    • #volumeUp
    • #volumeDown
    • #power
    • #camera

onPointerDragged

Called when touch (click) is moved.

Event Payload:

  • sender Object

    Object which caused this event.

  • x Integer

    X coordinates of pointer.

  • y Integer

    Y coordinates of pointer.

onPointerPressed

Called when touch (click) is stared.

Event Payload:

  • sender Object

    Object which caused this event.

  • x Integer

    X coordinates of pointer.

  • y Integer

    Y coordinates of pointer.

onPointerReleased

Called when touch (click) is finished.

Event Payload:

  • sender Object

    Object which caused this event.

  • x Integer

    X coordinates of pointer.

  • y Integer

    Y coordinates of pointer.

onProcess

Callback function, which is which is called from the object every 25ms.

onResize

Occurs when the control is resized.

Event Payload:

  • sender Object

    Object which caused this event.

  • width Integer

    New width of resized view.

  • height Integer

    New height of resized view.