How do you test two TextBoxes at the same time if they are both empty or contain the same character?

The blocks below work correctly if I close the two textboxes one after the other.
But if I leave them both blank and close the keyboard, an error appears.
How can I test both textboxes simultaneously?

What does this mean ?

Have you tried adding the code from one EnterPressed event to the other, and vice-versa, so that both textboxes are tested regardless of which textbox has the focus when "Enter is Pressed" ?

Sorry, my mistake. Initial both text boxes has data.
Case 1:

  1. I enter (change) the data in textbox1 or leave it blank or put only dot or only minus char.
  2. Click OK in keyboard window and close it.
    Everything is fine. The text box it is filled with zero.

Case 2:

  1. I enter (change) the data in textbox2 or leave it blank or put only dot or only minus char.
  2. Click OK in keyboard window and close it.
    Everything is fine. The text box it is filled with zero.

Case 3:

  1. I enter (change) the data in textbox1 in fact I leave it blank or I put only dot or only minus char.
  2. I enter (change) the data in textbox2 in fact I leave it blank or I put only dot or only minus char.
  3. Click OK in keyboard window and close it.
    Here I get the error.

Do you get the error regardless of which textbox has the focus ?

Can you share an aia project that repeats this behaviour ?

P and Q it is the 2 TextBoxes.
I try to replicate this diagram.

As I suggested this seems to work

You need to ensure that you only start your clock once, and call your procedure once, and close the keyboard once.

Assumes you need some kind of value in each textbox to proceed...

1 Like

Here is my test aia

testTextboxes.aia (22.2 KB)

If you still get an error, then the problem may be either in what your clock timer event is doing, or what your procedure is doing.

Yes, I knew this worked, but as I said in my post Canvas Stretched after returning from text boxes I want the canvas to be updated. That's why I need the timer.
Applying the example you provided, the canvas is no longer updated and remains stretched until the first touch of a control.

If the canvas is not visible then it will not have any settings (height/width)

Canvas must be made visible then start the clock ?

1 Like

Yes.
I need a method to prevent the cursor from moving from one textbox to another when the keyboard is displayed.
Or if the cursor moves then it should not leave behind an empty textbox.

When does that happen ?

Use the textbox.LostFocus event ?

No, I don't use textbox.LostFocus event.
It is certain that when the keyboard appears I can move the cursor to any textbox.
In this situation, when closing the keyboard, I can only test the content of the last textbox in which I entered data.
For this reason, if the other is empty, an error occurs.
I tried to check the content of the 2 textboxes in the canvas refresh procedure, but it doesn't work.

I thank you very much for your patience with me, but I think that if I don't manage to solve this problem I will give up.

I do not understand why the approach I suggested (with accompanying aia example) does not work for you? If one textbox (or both) are left empty then they are at least filled with a 0.0 before calling your procedure ?

I didn't say that it doesn't work, I just said that the canvas is no longer updated if I remove the timer.
With the timer running, however, the error I mentioned appears.

What is in your timer event block?

I'm sorry, the mistake was mine. The example you provided works correctly.
Thank you once again for your patience and help.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.