AppInventor

De MediaWiki do Campus São José
Revisão de 00h16min de 14 de abril de 2012 por Moecke (discussão | contribs)
Ir para navegação Ir para pesquisar

Componentes Básicos

Botão (Button)

Os botões são componentes que tocam os usuários para executar alguma ação em seu aplicativo. Os botões detectam quando os usuários os tocam. Muitos aspectos da aparência de um botão podem ser alterados. Você pode usar a propriedade Ativado (Activated) para escolher se um botão deve ou não ser utilizado.

Propriedades

BackgroundColor
Cor de fundo do botão.
Habilitado
Se definido, o usuário pode toque no botão para provocar ação.
FontBold
Se definido, o texto do botão é exibido em negrito.
FontItalic
Se definido, o texto do botão é exibido em itálico.
FontSize
O tamanho do ponto para o texto do botão.
FontTypeface
Família de fontes para o texto do botão.
Altura
Altura Button (y-size).
Largura
Largura Button (x-size).
Imagem
Imagem a ser exibida no botão.
Texto
Texto a ser exibido no botão.
TextAlignment
Centro, esquerda ou direita.
TextColor
Cores para o texto do botão.

Text Blocks

  • [#text text ]
  • [#equals = ]
  • [#join join ]
  • [#maketext make text ]
  • [#length length ]
  • [#text%3C text< ]
  • [#text= text= ]
  • [#text%3E text> ]
  • [#trim trim ]
  • [#upcase upcase ]
  • [#downcase downcase ]
  • [#startsat starts at ]
  • [#contains contains ]
  • [#splitatfirst split at first ]
  • [#splitatfirstofany split at first of any ]
  • [#split split ]
  • [#splitatany split at any ]
  • [#splitatspaces split at spaces ]
  • [#segment segment ]
  • [#replaceall replace all ]

text

Text.png

Contains a text string.

equals

Equals.png

Tests whether two given values are equal. If so, returns true; otherwise, returns false. This is the same block found in the logic drawer and is repeated here for convenience. The arguments can be anything, not just text.

join

Join.png

Appends the second given string to the first. For this operation, and all text operations, numbers can be treated as text. For example, using a join block to join 1 plus 1 and 2 times 3 results in 26 (2 joined with 6).

make text

Maketext.png

Joins all given values into one text string.

length

Length.png

Returns the length of the given string.

text<

Reports whether the first text string argument is alphabetically less than the second text string. If two strings begin with the same characters, the shorter string is considered smaller. Uppercase characters precede lowercase characters.

text=

Reports whether the text strings are identical, i.e., have the same characters in the same order.

Note that if you are comparing text boxes that contain digits, there is a difference between comparing them numerically using ordinary equality ( = ) versus comparing them as text strings ( text= ). If you create two text boxes, one with the characters 123 and one with the characters 0123 , then these will be equal numerically but not equal as text strings. Be careful that, when it comes to comparisons like this, there is a difference between entering the digits using number boxes, versus entering them as text boxes. Suppose you create two number boxes, on with 123 and one with 0123 . If you compare those two boxes using text= you'll get the result that they are equal. The reason is that the digits you enter into a number box get converted to a number; the actual string of digits is not preserved. If you want to take account of the actual string of digits, then use a text box.

text>

Reports whether the first text string argument is alphabetically greater than the second text string. If two strings begin with the same characters, the shorter string is considered smaller. Uppercase characters precede lowercase characters.

upcase

Returns a copy of its text string argument converted to uppercase.

downcase

Returns a copy of its text string argument converted to lowercase.

trim

Returns a copy of its text string argument with any leading or trailing spaces removed.

starts at

Startsat.png

Returns the character position where the first character of piece first appears in text , or 0 if not present. For example, the location of ana in havana banana is 4.

contains

Contains.png

Returns true if piece appears in text  ; otherwise, returns false.

split at first

Splitatfirst.png

Divides the given text into two pieces using the location of the first occurrence of at as the dividing point, and returns a two-item list consisting of the piece before the dividing point and the piece after the dividing point. Splitting apple,banana,cherry,dogfood with a comma as the splitting point returns a list of two items: the first is the text apple and the second is the text banana,cherry,dogfood . Notice that the comma after apple doesn't appear in the result, because that is the dividing point.

split at first of any

Splitatfirstofany.png

Divides the given text into a two-item list, using the location of any item in the list at as the dividing point.

split

Split.png

Divides text into pieces using at as the dividing points and produces a list of the results. Splitting one,two,three,four at , (comma) returns the list (one two three four) . Splitting one-potato,two-potato,three-potato,four at -potato, returns the list (one two three four) .

split at any

Splitatany.png

Divides the given text into a list, using any of the items in at as the dividing point, and returns a list of the results. Splitting appleberry,banana,cherry,dogfood with at as the two-element list whose first item is a comma and whose second item is rry returns a list of four items: (applebe banana che dogfood)

split at spaces

Splitatspaces.png

Divides the given text at any occurrence of a space, producing a list of the pieces.

segment

Segment.png

Extracts part of the text starting at start position and continuing for length characters.

replace all

Returns a new text string obtained by replacing all occurrences of the substring with the replacement.

Convertido de HTML para wiki com http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi -> falta trocar <code>, </syntaxhighlight> por <tt>, </tt>