Zebra API Doc

zebra.data.TextModel Class

Text model interface

Methods

getLine

(
  • line
)
String

Get the given string line stored in the model

Parameters:

  • line Integer

    a line number


Return: String

a string line

getLines

() Integer

Get number of lines stored in the text model


Return: Integer

a number of lines

getTextLength

() Integer

Get number of characters stored in the model


Return: Integer

a number of characters

getValue

() String

Get wrapped by the text model original text string


Return: String

an original text

remove

(
  • offset
  • size
)

Remove substring from the text model.

Parameters:

  • offset Integer

    an offset starting from that a substring will be removed

  • size Integer

    a size of a substring to be removed

setValue

(
  • text
)

Fill the text model with the given text

Parameters:

  • text String

    a new text to be set for the text model

write

(
  • s
  • offset
)

Write the given string in the text model starting from the specified offset

Parameters:

  • s String

    a string to be written into the text model

  • offset Integer

    an offset starting from that the passed string has to be written into the text model

Events

textUpdated

Fired when the text model has been updated: a string has been inserted or removed

   text.bind(function (src, b, off, len, startLine, lines) {
       ...
   });

Event Parameters:

  • src zebra.data.Text

    a text model that triggers the event

  • b Boolean

    a flag that is true if a string has been written in the text model, false if the model substring has been removed

  • off Integer

    an offset starting form that the text update took place

  • len Integer

    a length of text that has been affected by the text model update

  • startLine Integer

    a first line that has been affected by the text model update

  • lines Integer

    a number of lines that has been affected by the text model update