[F/OS] 📖 TextChanged - Detect Text Changes For Your Components!

:computer: Introduction

A non-visible extension to detect the changed text of a visible component, for example, TextBox or Button.

:package: Package name: com.gordonlu.textchanged.aix

:clock1: Version: 1

:date: Release date: 2022-03-21T10:00:00Z

:fountain_pen: Supports:

  • User Interface: Button, Checkbox, DatePicker, Label, ListPicker, PasswordTextBox, Switch, TextBox, TimePicker.

  • Media: ImagePicker

  • Social: ContactPicker, EmailPicker, PhoneNumberPicker

If you look in the Android Developers documentation for EditText (TextBox) and Button, you will see that they are all subclasses of TextView (Label), so technically, Button = TextView.

There might be a Clock solution for this, but when your app gets bigger and bigger, you don't want to check text changed events for 10 times or have 10 Clocks in your app.

:open_book: Documentation

Event blocks

OnTextChanged

image

This event is invoked when a component's text is changed.

Parameters: component = component

Method blocks

AddTextChangedListener

image

Listenes to text changed events for the given component and fires the OnTextChanged event when necessary.

Parameters: component = component

:inbox_tray: Downloads

AIX: com.gordonlu.textchanged.aix (7.1 KB)

:clipboard: Open Source

This extension is open source in GitHub.

:+1: Rate my extension! :-1:

  • Good extension!
  • Bad extension.
0 voters

Made with Niotron IDE.

Kindly :email: PM me if you have any questions! Also, if you like my extension, please :heart: like it! It takes some effort for me to make it...

Votes and likes tell me the general user feedback of my extension. If you read this extension, please take 20 seconds to drop by and give a vote / like!

If you have any features that you want to add and you know the code, PM me or directly reply below using the image button.

By downloading my extension, you agree the terms and conditions in my website.


Gordon Lu

:speech_balloon: Message :earth_africa: Website :e-mail: E-mail

11 Likes

In what circumstance the txt of Button will change by users and need a textchange event?
And there is a similar extension from Taifun i think.

Yes, Taifun's TextBox extension has that, but that only supports TextBoxes (2.3%). This supports 14.8% of all components in App Inventor.

For example, when the user is in a login/logout app, and you want to change the text of that login/logout app, that could be useful.

You can change the text of Button any time when you want, then this text-change event is triggered by your self, you will of course know when it's triggered, then why need another event block?

1 Like

That's an interesting question. That is not a problem for one component, but I find that an issue in some of my projects that use 40+ buttons and labels, and places that I have to change properties of components (including Text) several times. This extension is designed for projects that use a lot of components (and blocks). Remember - this extension also includes labels and textboxes.

Another reason that I made this is because of learning. This extension is open source right at the main post so that anyone can modify from the src code.

3 Likes

Maybe we can add this event listener on all / some of components with one block, no need to add listener one by one.

great extension!! :+1:t3: :+1:t3:

How to use this extension?
Would you give some examples?

  1. while screen initializing: call the Listener and attach the TextBox to its componet port.
  2. when OnTextChanged: set the component to TextBox
    and do the TextBox's logic.

algun .aia como ejemplo
saludos

I use your extension and when I open my project cant open it again

I'm sorry, but I've never encountered such problem that an extension can singlehandedly prevent a project from opening. Maybe it's because your project is too big and it takes a while to load.

Please download the AIA file of your project.

I try to get aia but doesn't respond

How many images do you have? Screens? Blocks? Extensions?

No image 3screen
Its lite app
I add extension and close my laptop
I open it and refused to open project

Did you try refreshing your browser? Or, closing your browser and opening your project again?

The most recommended browsers are Chrome and Firefox. You might experience some lags with Edge. IE is not compatible with App Inventor.

Other projects open...

I don't know if it is the extension's problem, but I think this is unlikely because I haven't seen anyone ever encountered such problem.

?

How many blocks are there?


Also,

You might want to switch to Firefox or Chrome and try again.