Why the TextBox1 suddenly disabled when re-focused?

HI,
I have a very sample testing APP attached here.

  1. When I enter 99 in the TextBox1, and then tapped TextBox2,
  2. the TextBox2 will become disabled, and then
  3. I requested TextBox1 to be focused again to let user to correct the number input (Only > 100 is allowed).
  4. The weird thing happened that TextBox1 become disabled, and I can't delete the original number nor change them. P.S.: When TextBo1 re-focused again by the code, App brought up a Full keyboard, not the number only.

TextBox1 setup: enabled, Numbers_Only

Is this a bug on App Inventor 2?

Kevin


new1 (2).aia (2.1 KB)

If values less than 100 are allowed, then you should use
if textBox1.Text >100

No, it's a problem with your app's logic.

Maybe I didn't say it clearly.
I intentionally to enter 99 in the textBox1, so the warning message will be triggered.
After App Inventor re-focus on textBox1, the text become "uneditable"!

So, I was suspecting there's a bug in App Inventor.

Thank you,

Kevin

We can't see your blocks in the GotFocus event, so we can't see what happens when the TexBox regains focus... So I still say it's a logic error in your program, or a lack of additional logic.

I didn't have a GotFocus event on TextBox1. That's all the blocks I have in the thread.
Please try the new1.aia file and you will see what happened on the TextBox1.
After regain focused, it can't be altered.

Thank you,
Kevin

Based upon your blocks/layout, try like so:

Thanks for your quick reply! I will give your code a try.

Regarding my code above, why when TextBox1 regain focused, it couldn't be altered?
I would like to know the reason why? If you know, please let me know.

Best regards,
Kevin

Some kind of bug, both textboxes end up having focus which seemed to disable both from any data entry (even without using the "enabled" true/false blocks)

1 Like

I tried aia, I misunderstood the problem before. A strange thing indeed.

1 Like

Blockquote
Some kind of bug, both textboxes end up having focus which seemed to disable both from any data entry (even without using the "enabled" true/false blocks)

Right...after TextBox1 regain focused, not only it can't be edited, but the keyboard showing a full keyboard, not number_only keyboard (Originally defined as numbers only).

A little delay with a timer also helps. These blocks work. Switching focus too quickly causes TextBox2 to still have focus, even though TextBox1 looks like it has focus.



Maybe Evan can explain what's going on here.

2 Likes