B4J Question textchange_event

elitevenkat

Active Member
Licensed User
Longtime User
B4X:
     txtPos.Text=cVal     ' i had assumed txtPos_Textchanged event will fire immediatly after this
     txtPos.Tag=cKey     ' but the flow goes to next line and continues 
       
     txtTable.RequestFocus
     txtTable.Text=" "
     txtTable.Text=""          
                 
[\code]

above is a part of a sub. The problem is the execution order of the txtPos_Textchanged and txtTable_Textchanged events. 

i found that in some occasions, txtPos_Textchanged event is  executed first and some times, txtTable_Textchanged event is executed first and vice versa. The execution order is done randomly.

i found out this in debug mode.
 

Attachments

  • upload_2016-5-1_6-42-4.png
    upload_2016-5-1_6-42-4.png
    326 bytes · Views: 190

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
This is the way Java FX works.

1.- All the code will be executed, the UI thread will be blocked until then.

2.- Everytime a new UI functions is called (textchanged) it will be put in a Queue, the order of the queue is not known nor can be predicted.

3.- When the UI function begins to execute it will take the last state of the program to work. That means that if TxtPos.text changed 3 times, it will take the value of the third one.
 
Upvote 0

elitevenkat

Active Member
Licensed User
Longtime User
That means that if TxtPos.text changed 3 times, it will take the value of the third one.
The tempos.text is changed only once. The txttable.text is changed 2 times. However the order of execution varies. Out of 10 times, 8 times it executes in the order of change made FIFO method . But for 2 times it executes last if first out method.
That means we do not have any control over the ui events execution ( the order/ sequence). Correct?
 
Upvote 0
Top