Tag richEdit

.html ›› .html ›› .html ››
Parent Previous Next

Tag richEdit

A tag/componente richEdit representa uma caixa de texto de múltiplas linhas com possibilidade de adicionar formatação, cores, alinhamentos, imagens, etc... Um ótimo controle para permitir a entrada de dados "texto ricos".


Herança

O richEdit possui todas as características de uma tag visual. Veja:

Características

Além das características herdadas, a tag richEdit também possui as seguintes características:


Propriedades e atributos


Propriedade

Tipo

Valor Padrão

Descrição

animateImages

Boolean

false

Define se o RichEdit deve executar a animação de imagens que são animadas (exemplo: GIF, GIFV) quando suportadas.


readOnly 

Boolean

false

Quando true, o richEdit não permite o usuário alterar seu conteúdo


field

String

<string vazio>

Caminho de um campo no NodeDatabase.


Quando associado, o richEdit passa a apresentar e salvar o conteúdo no campo informado.


Veja também:

backgroundColor

String de Cor

"White"

Define a cor de fundo do RichEdit.


Exemplos:

  • Black
  • White
  • #FDFDFD


Veja String de cores no Lua Form para obter a completa de cores e outras formas de uso.


defaultFontColor

String de Cor

"Black"

Define a cor padrão para os textos do richEdit


Exemplos:

  • Black
  • White
  • #FDFDFD


Veja String de cores no Lua Form para obter a completa de cores e outras formas de uso


defaultFontSize

Float

15


Define o tamanho de fonte padrão para os textos do richEdit


showToolbar

Boolean

true

Define se o richEdit deve apresentar uma baixa de ferramentas para auxiliar o usuário a formatar seu texto.


hideSelection

Boolean

true

Define se a seleção que o usuário fizer (com o mouse ou teclado) será apresentada quando ele estiver focado em outro controle.


True - A seleção continuará existindo, porém não será exibida visualmente se o usuário estiver focado em outro controle


False - A seleção continuará existindo e será exibida visualmente mesmo se o usuário estiver focado em outro controle.



Methods


Method

Description

richEdit:beginEdit() 

Starts a batch of edit operations. Each call to beginEdit() must be balanced with another call to endEdit()


richEdit:endEdit()

Ends a batch of edit operations. Each call to beginEdit() must be balanced with another call to endEdit()


richEdit:selectAll()

Selects the entire content of the richEdit.


richEdit:unselect()

Cancels all selections made to the richEdit.


richEdit:getLengthInChars()

Returns the length of the richEdit content in UTF-16 char units.


richEdit:getLengthInGlyphs()

Returns the length of the richEdit content in glyph units.


richEdit:getSelectionPosInChars()

Returns two integers containing the current selection start index and selection end index. If both numbers are equal, there is no selection but a single caret at the specified index.


The returned indexes are in UTF-16 character units.


richEdit:getSelectionPosInGlyphs()

Returns two integers containing the current selection start index and selection end index. If both numbers are equal, there is no selection but a single caret at the specified index.


The returned indexes are in glyph units.


richEdit:getIsSelectionForward()

Returns true if the current selection is forward and false if it is backwards.


richEdit:getSelectionText()

Returns the string content of the current selection.


richEdit:getSelectionURL()

Returns the URL address of the current selection or an empty string if no links are selected.


richEdit:getSelectionFontColor()

Returns a Color String identifying the font color of the selected text.


richEdit:getSelectionFontBkgColor()

Returns a Color String identifying the font background color of the selected text.


richEdit:getSelectionFontSize()

Returns the font size of the selected text.


richEdit:getSelectionFontFamily()

Returns the font family name of the selected text.


richEdit:getSelectionFontStyle()


Returns the font style of the selected text. It is an array that may contain the following strings: "bold", "italic", "underline", "strikeout".


richEdit:getSelectionFloat()

Returns the float mode of the selected text. It can be one of the following values: "none", "left", "right".


richEdit:getSelectionParaAlign()

Returns the paragraph alignment of the selected text. It can be one of the following values: "left", "center", "right", "justify".


richEdit:getText()

Returns the content of the richEdit as plain text.


richEdit:gotoStart([holdSelection])

Moves the caret to the beginning of the content. 


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoEnd([holdSelection])

Moves the caret to the end of the content. 


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoNext([holdSelection])

Moves the caret to the next glyph position.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPrevious([holdSelection])

Moves the caret to the previous glyph position.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoStartOfLine([holdSelection])

Moves the caret to start of the current line.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoEndOfLine([holdSelection])

Moves the caret to end of the current line.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoNextWord([holdSelection])

Moves the caret to the next word.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPreviousWord([holdSelection])

Moves the caret to the previous word.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoLineUp([holdSelection])

Moves the caret to the line above.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoLineDown([holdSelection])

Moves the caret to the line bellow.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPageUp([holdSelection])

Moves the caret to the page up.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPageDown([holdSelection])

Moves the caret to the page down.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPositionInGlyphs(pos, [holdSelection])

Moves the caret to the specified position measured in glyph count.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:gotoPositionInChars(pos, [holdSelection])

Moves the caret to the specified position measured in UTF-16 char count.


Set "holdSelection" to "true" if you want to keep and/or build a selection with the caret movement, simulating the behavior as if the "shift" key were held.


richEdit:copySelectionToClipboard()

Copies the content of the current selection to the clipboard.


richEdit:deleteSelection()

(Edit Operation) Deletes the current selection from the richEdit content.


richEdit:insertText(text)

(Edit Operation) Inserts the specified text into the current caret position, deleting selected content if any, and moving the caret to the end of the inserted text.


richEdit:insertTalemark(talemarkText[, talemarkOptions])

(Edit Operation) Inserts the specified talemark text into the current caret position, deleting selected content if any, and moving the caret to the end of the inserted text.


Arguments:

  • talemarkText - A string containing the Talemark text to be inserted.
  • (Optional) talemarkOptions  - A TalemarkOptions table parameter to configure the text generation.


richEdit:insertImage(params)

(Edit Operation) Inserts a image into the current caret position, deleting selected content if any, and moving the caret to the end of the inserted image.


Arguments:

  • params - A lua table containing the following fields:
    • url - A string containing the URL Address of the image
    • width - A number defining the width of the image
    • height - A number defining the height of the image
    • (Optional) drawMode - How the image should be rendered. It can be one of the following values: "proportional", "autoFit", "originalSize", "stretch".


richEdit:breakLine()

(Edit Operation) Inserts a line break into the current caret position, deleting selected content if any, and automatically moving the caret to the end of the inserted text.


richEdit:breakParagraph()

(Edit Operation) Inserts a paragraph break into the current caret position, deleting selected content if any, and moving the caret to the end of the inserted text.


richEdit:indent(qty)

(Edit Operation) Changes the indentation of the selected text. The argument "qty" defines how much to indent:

- A positive non-zero integer value to indent to the right.

- A negative non-zero integer value to indent to the left.


richEdit:pasteFromClipboard()

(Edit Operation) Inserts the content of the clipboard into the current caret position, deleting selected content if any, and moving the caret to the end of the inserted text.


richEdit:cutSelectionToClipboard()

(Edit Operation) Removes the current selection from the richEdit content and places it into the user clipboard.


richEdit:setSelectionURL(url)

(Edit Operation) Changes the URL address of the selected text, creating a link if needed. If the argument "url" is empty, then the link is removed.


richEdit:setSelectionFontColor(color)

(Edit Operation) Changes the font color of the selected text to the specified Color String


richEdit:setSelectionFontBkgColor(color)

(Edit Operation) Changes the font background color of the selected text to the specified Color String


richEdit:setSelectionFontSize(size)

(Edit Operation) Changes the font size of the selected text to the specified number.


richEdit:setSelectionFontFamily(family)

(Edit Operation) Changes the font family of the selected text to the specified string.


richEdit:setSelectionFontStyle(style)

(Edit Operation) Changes the font style of the selected text. The argument "style" is an array that may contain the following strings: "bold", "italic", "underline", "strikeout".



richEdit:setSelectionFloat(floatMode)

(Edit Operation) Changes the float mode of the selected text. The argument "floatMode" can be one of the following strings: "none", "left", or "right".


richEdit:setSelectionParaAlign(paraAlign)

(Edit Operation) Changes the paragraph alignment of the selected text. The argument "paraAlign" can be one of the following strings: "left", "center", "right", or "justify".



Eventos

Nome do evento

Descrição




Veja Tratando eventos do Lua Form


Exemplos:

Exemplo 1 - Um richEdit simples


<?xml version="1.0" encoding="UTF-8"?>

<form ......>

    <richEdit align="client" backgroundColor="black" defaultFontColor="white" field="txt"/>

</form>







Created with the Personal Edition of HelpNDoc: From Word to ePub or Kindle eBook: A Comprehensive Guide