Component
Reference
This
document describes the components you can use in App Inventor to build your
apps.
Each component can have methods, events, and properties. Most properties can be changed by apps — these properties have blocks you can use to get and set the values. Some properties can’t be changed by apps — these only have blocks you can use to get the values, not set them. Each item is annotated with additional text to indicate the type of the item, whether it is read-only, and whether it only exists in the designer or blocks.
User Interface
Button
Button
with the ability to detect clicks. Many aspects of its appearance can be
changed, as well as whether it is clickable (Enabled
). Its properties can be changed in
the Designer or in the Blocks Editor.
Properties
BackgroundColor
Specifies the Button
’s background color as an
alpha-red-green-blue integer. If an Image
has been set, the color change will not be visible
until the Image
is removed.
Enabled
Specifies whether the Button
should be active and clickable.
FontBold
Specifies whether the
text of the Button
should be bold. Some fonts do not support bold.
FontItalic
Specifies whether the
text of the Button
should be italic. Some fonts do not support italic.
FontSize
Specifies the text font
size of the Button
, measured in sp(scale-independent pixels).
FontTypeface
Specifies the text font
face of the Button
as default, serif, sans serif, or monospace.
Height
Specifies the Button
’s vertical height, measured in
pixels.
HeightPercent
Specifies the Button
’s vertical height as a percentage of
the Screen
’s Height
.
Image
Specifies the path of
the Button
’s image. If there is both an Image
and a BackgroundColor
specified, only
the Image
will be visible.
Shape
Specifies the shape of
the Button
. The valid values for this property are 0
(default), 1
(rounded), 2
(rectangle), and 3
(oval). The Shape
will not be visible if an Image
is used.
ShowFeedback
Specifies if a visual feedback
should be shown when a Button
with an assigned Image
is pressed.
Text
Specifies the text
displayed by the Button
.
TextAlignment
Specifies the alignment
of the Button
’s text. Valid values are: 0
(normal; e.g., left-justified if
text is written left to right), 1
(center), or 2
(opposite; e.g., right-justified
if text is written left to right).
TextColor
Specifies the text color
of the Button
as an alpha-red-green-blue integer.
Visible
Specifies whether
the Button
should be visible on the screen. Value is true
if the Button
is showing and false
if hidden.
Width
Specifies the horizontal
width of the Button
, measured in pixels.
WidthPercent
Specifies the horizontal
width of the Button
as a percentage of the Screen
’s Width
.
Events
Click()
Indicates that the user
tapped and released the Button
.
GotFocus()
Indicates the cursor
moved over the Button
so it is now possible to click it.
LongClick()
Indicates that the user
held the Button
down.
LostFocus()
Indicates the cursor
moved away from the Button
so it is now no longer possible to click it.
TouchDown()
Indicates that the Button
was pressed down.
TouchUp()
Indicates that the Button
has been released.
Methods
None
Post a Comment