Bug? Views are not ready but their events are triggered

LucaMs

Expert
Licensed User
Longtime User
This is nothing new and I know what somersaults I have to do :confused: to get around this obstacle but if Erel could remedy this problem...!

By running a B4XPages.Show(SomePageID) command, the B4XPage_Created event routine of that page is correctly and immediately executed and the layout loaded (or, more precisely, within that event I write the code to load the layout). Events like TextChanged, in my case of B4XFloatTextFields, are triggered immediately, but the views are not yet available, actually created, and this is a problem.

Concrete example: I want to enable/disable a button based on the text contained in some B4XFloatTextFields, i.e. if the user has filled in those fields and with valid values.

I am attaching an example. Again, I know how to get around this problem but it would be better if it didn't exist.


P.S. I also have to act on those views for other reasons and obviously the problem is the same.
 

Attachments

  • UITest.zip
    15.6 KB · Views: 87
Last edited:

LucaMs

Expert
Licensed User
Longtime User
The problem is due precisely to the B4XFloatTextFields; in fact, replacing them with normal EditTexts, the events are not triggered without user intervention.

Furthermore, the EditText are also available in the Created as soon as the layout is loaded, unlike the B4XFloatTextField.TextField.
 
Last edited:

Marvel

Active Member
Licensed User
I also had this problem in the past. I solved it by using Boolean. Had no idea it was caused by B4XFloatTextFields in B4xpages
 

angel_

Well-Known Member
Licensed User
Longtime User
I think my problem in this thread is related to that:

In this app I only use B4XFloatTextField.
I also solved it with a Boolean
 

LucaMs

Expert
Licensed User
Longtime User
I think my problem in this thread is related to that:

In this app I only use B4XFloatTextField.
I also solved it with a Boolean
It's not a question of loading time; as you can see the attached test project contains practically nothing and yet the problem is there.

The fact is that those events are triggered before the B4XFloatTextFields have actually been created and this, strangely, happens only when the B4XPage_Created event is completed.

Wanting to access those views after the completion of B4XPage_Created, you could call a routine from within this one using CallSubDelayed, but the B4XPage_Appear event would fire before that routine.

I too had to solve with a module-level boolean variable (which I use in Appear), like the "old" FirstTime .
 
Top