TextboxUtil

Published on February 17, 2022

🏷️ Tags: #extensions

A non-visible extension that provides additional tools to the App Inventor built-in TextBox component. All blocks in this extension support both single line and multi-line TextBoxes.

Made with Niotron IDE at https://ide.niotron.com.

Current version: 10 Package name: com.gordonlu.textboxutil.aix

For more information, read this MIT App Inventor Community thread.

βš™οΈ This extension only supports builders that allow AndroidX extensions, e.g., MIT App Inventor, Kodular. To find out whether your builder has AndroidX support, contact the builder team.

πŸ† NOTE: The source code of this extension is only available for CodeChamps. Apply to be a CodeChamp to access this content! If you are a CodeChamp, open the exclusive materials document and find the extension source code.

πŸ“– Documentation

Method blocks

AlignText - Aligns the text of the TextBox. 1 is left/top, 2 is center and 3 is right/bottom.

Parameters: textBox = component, alignHorizontal = number (int), alignVertical = number (int)

DismissErrorMessage - Clears the error message shown on the tip of the given TextBox.

Parameters: textBox = component

GetOpacity - Returns the opacity of the TextBox. 0 is less opaque and 255 is most opaque. Returns: number (float)

Parameters: textBox = component

GetSelectedText - Returns the selected text from the given text box. Returns: text

Parameters: textBox = component

MoveCursorPosition - Moves the cursor to the specific position. Only works when the TextBox is focused.

Parameters: textBox = component, position = number (int)

RemoveFocus - Removes focus for both the textbox frame and the cursor of the textbox. This does not hide the keyboard of the textbox.

Parameters: textBox = component

SelectAll - Selects all of the text in the given TextBox. This function only works when the TextBox is focused.

Parameters: textBox = component

SelectPartial - Selects the text of the TextBox according to the start and the end position. Only works if the TextBox is focused.

Parameters: textBox = component, start = number (int), end = number (int)

SetCursorVisibility - Sets the visibility of the cursor.

Parameters: textBox = component, visible = boolean

SetElevation - Sets the elevation for the given TextBox in pixels.

Parameters: textBox = component, elevation = number (float)

SetFontTypeface - Sets the font typeface of the TextBox, including whether to bold, italicize, and the font of the TextBox. Use the blocks in the properties of this extension for the font parameter. If useCurrentFont is true, the font parameter will be ignored.

Parameters: textBox = component, bold = boolean, italic = boolean, font = text, useCurrentFont = boolean

SetHintColor - Sets the hint color for the given TextBox.

Parameters: textBox = component, color = color

SetInputType - Sets the input type for the TextBox. Use the blocks in the Properties to set the type parameter.

Parameters: textBox = component, type = number (int)

SetLinksColor - Sets the color of the links in the TextBox. Before you set the links, you need to linkify the TextBox using the Linkify extension.

Parameters: textBox = component, color = color

SetMaxLength - Sets the maximum length for the textbox. If you set the textbox's text longer than the length before you call this, the text will still be there undeleted.

Parameters: textBox = component, length = number (int)

SetMaxLines: Sets the maximum lines the TextBox can contain. This block only works with TextBoxes with normal input type.

Parameters: textBox = component, lines = number (int)

SetOpacity - Sets the opacity of the TextBox. 0 is less opaque and 255 is most opaque.

Parameters: textBox = component, opacity = number (float)

SetPadding - Sets the padding of the given TextBox.

Parameters: textbox = component, left = number (int), top = number (int), right = number (int), bottom = number (int)

SetRotation - Rotates the TextBox according to the rotation angle.

Parameters: textBox = component, rotation = number (float)

SetSelectAllOnFocus - Sets the TextBox so that when it takes focus, all the text is selected. This will not function if the TextBox is focused - you need to disable focus, set it, and then focus again.

Parameters: textBox = component, setSelectOnFocus = boolean

ShowContextMenu - Shows the context menu for this TextBox. Returns true if the context menu was shown, else false. Returns: boolean

Parameters: textBox = component

ShowErrorMessage - Shows an error message on the tip of the given TextBox.

Parameters: textBox = component, message = text

Property blocks

DefaultFont - A font block. Returns: "DEFAULT"

InputDate - An input type block. Returns: 16

InputDateTime - An input type block: Returns: 4

InputNumber: An input type block. Returns: 2

InputPhoneNumber: An input type block. Returns: 3

InputText - An input type block. Returns: 1

InputTime - An input type block. Returns: 32

Monospace - A font block. Returns: "MONOSPACE"

SansSerif - A font block. Returns: "SANS SERIF"

Serif - A font block. Returns: "SERIF"

Sample program #1 with TextboxUtil

TERMS AND CONDITIONS

By downloading or sharing my extension, you agree to follow these terms and conditions.

  1. Have fun using the extension!

  2. This, along with the MIT App Inventor original post above, are the only authorized places to download this extension. As an organization, you are not allowed to host and advertize this extension on your website, document, tweet, blog, article or any software you made without my authorization. You are also reminded not to include a direct download link of this extension on your website without my permission. If you are interested in the actions listed above, please contact me via email. Do remember that if you violate term no. 2, AICODE has the right to flag your website, document, tweet, blog or article as a violation of copyright, or other legal actions will be taken. Please contact me if you find anyone do this.

However, you can copy the link of this webpage and share it to someone as a personal identity (not as an organization), or sharing it on these authorized forums: App Inventor, Kodular, Niotron, Appzard and Android Builder communities. The term organization includes schools, markets and app stores, companies and social groups. Thank you for your understanding.

Those organizations are authorized to advertize or host my extension:

  • Kodular admins

  • MIT App Inventor admins

  • Pura Vida Apps / Taifun Baer

  1. Selling this extension/product to anyone is not allowed unless authorized by AICODE.

  2. These terms and conditions are written and issued on December 20, 2021. AICODE has the total permission to edit these terms and conditions anytime.