Zebra API Doc

zebra.data.SingleLineTxt Class

Single line text model implementation

Constructor

zebra.data.SingleLineTxt

(
  • [s]
  • [max]
)

Parameters:

  • [s] String optional

    the specified text the model has to be filled

  • [max] Integer optional

    the specified maximal text length

Methods

getLine

(
  • line
)
String

Inherited from zebra.data.TextModel:

Get the given string line stored in the model

Parameters:

  • line Integer

    a line number


Return: String

a string line

getLines

() Integer

Inherited from zebra.data.TextModel

Get number of lines stored in the text model. The model can have only one line


Return: Integer

a number of lines

getTextLength

() Integer

Inherited from zebra.data.TextModel:

Get number of characters stored in the model


Return: Integer

a number of characters

getValue

() String

Inherited from zebra.data.TextModel:

Get wrapped by the text model original text string


Return: String

an original text

remove

(
  • offset
  • size
)

Inherited from zebra.data.TextModel:

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

setMaxLength

(
  • max
)

Set the given maximal length the text can have

Parameters:

  • max Integer

    a maximal length of text

setValue

(
  • text
)

Inherited from zebra.data.TextModel:

Fill the text model with the given text

Parameters:

  • text String

    a new text to be set for the text model

write

(
  • s
  • offset
)

Inherited from zebra.data.TextModel:

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

Attributes

maxLen

Integer readonly

Maximal text length. -1 means the text is not restricted regarding its length.

Default: -1

Events

textUpdated

Inherited from zebra.data.TextModel:

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