Wish: Android Tab/Focus Order

Roger Garstang

Well-Known Member
Licensed User
Longtime User
Had an interesting and long thread lately where for some reason Android was allowing a disabled Edit Box to get focus through the Keyboard Next button. This and other thoughts really got me thinking we need some way to keep track of the controls. Something like this may have been suggested before, but I think it can be done and would really make B4A stand out.

The Activity allows us to parse through the controls/views in an indexed manner which is nice, but we need some type of access that is more like a linked list too. Something at the view level like .NextView and .PreviousView. Previous View may not be needed 100%, but there could be uses for it too. It would have to be something internal to B4A that happens as a layout is loaded or a view is added to an activity or panel where in the generated code it sets these values. Possibly even a boolean setting in the activity/panel where it loops or not (Last points to first, first points to last if PreviousView implemented).

This would allow for easily creating some interesting screens. You could create a click even for all labels that when the label is tapped it sets focus to the Edit Box next to it, etc. It could even be further enhanced to have some type of option like TabStop, although in Android it may be called a boolean like CanFocus. Then only those views would store .NextView values and the rest would be a null or -1 or something.

The type of .NextView/.PreviousView could be many things. We could use an Int and make use of the Activity.GetView or maybe a View like Sender where it could point to the control itself.