Tabhost and Editbox focus

fastlane69

Member
Licensed User
Longtime User
I have a tabhost with 3 tabs. One set of tab consists of several edittext within a scollview.

Whenever I enter this edittext tab for the first time, I don't get the soft keyboard. I can select an edittext, enter text, and exit it no problem.

HOWEVER, when I leave it and come back focus automatically goes to a visible edittext (not necessarily one I chose previously) with the soft keyboard popping up automatically.

ALSO, when I press enter on one edittext, the focus automatically drops to the next edittext(which is not what I want)

Clearly this is not good behaiviour as I would like the keyboard to ONLY show up with an edittextis selected and I would like an edittextto ONLY be selected by a touch event and not, as it's doing now, automatically when I enter the tab or press "enter" on another edittext. As well, when I press enter I would like for the soft keyboard to disappear and no other edittextselected.

My code is rather long and tedious so any general advice or help you can give me without have to post it would be great. I've attached my apk file for your consideration and (if it works for you) the problem tab is "procedures".

Thanks in advance for reading this and your help!
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You have uploaded the apk file not the source code. You can upload the project using File - Export as zip.

You can use EditText.ForceDone = True to prevent the focus from moving to the next view.
You can use the IME library to hide the keyboard when the tab changes. You will however need the full version in order to work with this library.
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
I love the ime library.

In my work application I had the same issues and did what Erel is saying and now it works very nicely.

A top given you me to stop the auto focusing is to create an edittext off screen, set it's Input to None. Request focus your it and your edittext will be happy campers.

Regards, Ricky
 
Upvote 0

Ricky D

Well-Known Member
Licensed User
Longtime User
I love the ime library.

In my work application I had the same issues and did what Erel is saying and now it works very nicely.

A tip given you me to stop the auto focusing is to create an edittext off screen, set it's Input to None. Request focus your it and your edittext will be happy campers.

Regards, Ricky
 
Upvote 0

fastlane69

Member
Licensed User
Longtime User
Edittext.forcedone is not being recognized by the compiler nor does the beginners guide list forcedone as a member of edittext (forcedonebutton yes but not forcedone).

I have bought the full version though I've not downloaded any libraries.

My core is showing as 1.77 and I can't find where to download Core 1.8 or 1.9

As you can tell by my earlier noob upload I'm new at this. :)
 

Attachments

  • physics.zip
    12.6 KB · Views: 280
Upvote 0

fastlane69

Member
Licensed User
Longtime User
I tried several combinations of forcedonebutton including setting it when I create it and as a subroutine called when tabchanged is triggered but no effect.

:(

I zipped my files above for you all to see if you can a) replicate the error and b) find a solution.

:)
 
Upvote 0

fastlane69

Member
Licensed User
Longtime User
So I have everything sorted, have advanced significantly in my project, but still the same problem with the scrollview filled with edittexts.

I did find out however the following:
-when I "touch-scroll" the procedures (3rd tab), I get the unwanted behavior (that an edittext is selected and the keyboard pops up if I scroll enough up or down).
-however when I "spinner-scroll" (ie, directly manipulate scrollposition), I do NOT get an automatic edittext selection.

Any advice?
 
Upvote 0

fastlane69

Member
Licensed User
Longtime User
This being my first app I'm just trying it out with my tablet (Dell Streak 7") and only in one orientation. Once I get the basic down then I will mess with different orientations and tablet sizes.

Hmmm... it might be a "uniqueness" of my tablet. I'm in the process of trying to get it on other models.

Thanks for the trial though; I appreciate it and, if you aren't having the issue, maybe others won't either! :)

Thanks again!
 
Upvote 0
Top