Hello everyone,
Although I roughly know that it has something to do with Wait For or Sleep, I have looked through many posts but still cannot find a proper solution. Could someone please guide me on which concepts I should focus on and how to modify the code?
Please see the attachment.
1.In B4XMainPage, why does Log(Send.tag) in edt_TextChanged() get triggered multiple times when the page first runs? My intention was to make the font color of the three EditText controls blue, but due to the multiple triggers, only the last EditText control's font color turns red.
2.In the Button2_Click() event of Page1, my intention is to call ReturnCtlValue() to change the values of the three EditText controls in B4XMainPage, which would then trigger the edt_TextChanged() event to update the text color of the three controls. However, the expected behavior only occurs when Sleep(0) is added in Button2_Click(). When Sleep(0) is commented out, Button2_Click() runs completely before triggering edt_TextChanged(), resulting in only edt3's text color changing, even though the values of the three EditText controls have been updated.
Any help would be greatly appreciated! Thank you!
Although I roughly know that it has something to do with Wait For or Sleep, I have looked through many posts but still cannot find a proper solution. Could someone please guide me on which concepts I should focus on and how to modify the code?
Please see the attachment.
1.In B4XMainPage, why does Log(Send.tag) in edt_TextChanged() get triggered multiple times when the page first runs? My intention was to make the font color of the three EditText controls blue, but due to the multiple triggers, only the last EditText control's font color turns red.
2.In the Button2_Click() event of Page1, my intention is to call ReturnCtlValue() to change the values of the three EditText controls in B4XMainPage, which would then trigger the edt_TextChanged() event to update the text color of the three controls. However, the expected behavior only occurs when Sleep(0) is added in Button2_Click(). When Sleep(0) is commented out, Button2_Click() runs completely before triggering edt_TextChanged(), resulting in only edt3's text color changing, even though the values of the three EditText controls have been updated.
Any help would be greatly appreciated! Thank you!