App inventor Tutorials _ CheckBox

 

CheckBox



CheckBox components can detect user taps and can change their boolean state in response.

CheckBox component raises an event when the user taps it. There are many properties affecting its appearance that can be set in the Designer or Blocks Editor.

Properties

BackgroundColor

Specifies the background color of the CheckBox as an alpha-red-green-blue integer.

Checked

Set to true if the box is checked, false otherwise.

Enabled

Specifies whether the CheckBox should be active and clickable.

FontBold

Specifies whether the text of the CheckBox should be bold. Some fonts do not support bold.

FontItalic

Specifies whether the text of the CheckBox should be italic. Some fonts do not support italic.

FontSize

Specifies the text font size of the CheckBox, measured in sp(scale-independent pixels).

FontTypeface

Specifies the text font face of the CheckBox as default, serif, sans serif, or monospace.

Height

Specifies the CheckBox’s vertical height, measured in pixels.

HeightPercent

Specifies the CheckBox’s vertical height as a percentage of the Screen’s Height.

Text

Specifies the text displayed by the CheckBox.

TextColor

Specifies the text color of the CheckBox as an alpha-red-green-blue integer.

Visible

Specifies whether the CheckBox should be visible on the screen. Value is true if the CheckBox is showing and false if hidden.

Width

Specifies the horizontal width of the CheckBox, measured in pixels.

WidthPercent

Specifies the horizontal width of the CheckBox as a percentage of the Screen’s Width.

Events

Changed()

User tapped and released the CheckBox.

GotFocus()

CheckBox became the focused component.

LostFocus()

CheckBox stopped being the focused component.

Methods

None

DatePicker

A button that, when clicked on, launches a popup dialog to allow the user to select a date on the Gregorian Calendar.

Note: Date and time are manipulated using methods in the Clock component.

Properties

BackgroundColor

Specifies the DatePicker’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.

Day

Returns the Day of the month that was last picked using the DatePicker.

Enabled

Specifies whether the DatePicker should be active and clickable.

FontBold

Specifies whether the text of the DatePicker should be bold. Some fonts do not support bold.

FontItalic

Specifies whether the text of the DatePicker should be italic. Some fonts do not support italic.

FontSize

Specifies the text font size of the DatePicker, measured in sp(scale-independent pixels).

FontTypeface

Specifies the text font face of the DatePicker as default, serif, sans serif, or monospace.

Height

Specifies the DatePicker’s vertical height, measured in pixels.

HeightPercent

Specifies the DatePicker’s vertical height as a percentage of the Screen’s Height.

Image

Specifies the path of the DatePicker’s image. If there is both an Image and a BackgroundColor specified, only the Image will be visible.

Instant

Returns instant of the date that was last picked using the DatePicker.

Month

Returns the number of the Month that was last picked using the DatePicker.

MonthInText

Returns the name of the Month that was last picked using the DatePicker.

Shape

Specifies the shape of the DatePicker. 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 DatePicker with an assigned Image is pressed.

Text

Specifies the text displayed by the DatePicker.

TextAlignment

Specifies the alignment of the DatePicker’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 DatePicker as an alpha-red-green-blue integer.

Visible

Specifies whether the DatePicker should be visible on the screen. Value is true if the DatePicker is showing and false if hidden.

Width

Specifies the horizontal width of the DatePicker, measured in pixels.

WidthPercent

Specifies the horizontal width of the DatePicker as a percentage of the Screen’s Width.

Year

Returns the Year that was last picked using the DatePicker.

Events

AfterDateSet()

Event that runs after the user chooses a Date in the dialog.

GotFocus()

Indicates the cursor moved over the DatePicker so it is now possible to click it.

LostFocus()

Indicates the cursor moved away from the DatePicker so it is now no longer possible to click it.

TouchDown()

Indicates that the DatePicker was pressed down.

TouchUp()

Indicates that the DatePicker has been released.

Methods

LaunchPicker()

Launches the DatePicker dialog. The AfterDateSet event will be run after the user confirms their selection.

SetDateToDisplay(year,month,day)

Allows the user to set the date to be displayed when the date picker opens. Valid values for the month field are 1-12 and 1-31 for the day field.

SetDateToDisplayFromInstant(instant)

Allows the user to set the date from the instant to be displayed when the date picker opens.

Post a Comment

Previous Post Next Post