This code
B4XTable1.SearchField.RequestFocusAndShowKeyboard
works wonderfully, the B4XTable needs a short moment until it is finished building and only then can you set the focus on the search field.
Set a
Sleep(250)
to solve your problem.
B4XTable1.SetData(StateData)
Sleep(250)
RequestSearchFieldFocus
Thank you for the very simple solution! I thought the CallSubDelayed() was doing that, but apparently not!
I wonder if B4XTable could probably have a _Ready() function. In fact, anything that might take its own sweet time to get ready should probably have one.
That way, we don't have to resort to a kludge of Sleep(), which might be inconsistent between systems in timing. But I guess a few milliseconds will never hurt anyone.
What is best-practice in this case? Would Wait for() be useful here, maybe on the SetData() call?
(Just trying to wrap my head around the B4X paradigm so I don't get stuck like this in the future.)