No Edit Boxes with focus

TomDuncan

Active Member
Licensed User
Longtime User
Hi All,
I have a project with many tabhosts and many edittexts within these.
When I switch tabs I get a focus on the first tab. This brings up the keyboard.
This is a pain when most of the time all I want to do is view.
How can I make it that nothing has the focus until I select it.
I have dimmed an editfocus as EditText, Initiaiized it then on any tab change
I call a editFocus.RequestFocus

But this does not work. My thoughts were that this edittect would take the focus. Oh well just a :sign0104:

Tom
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried to reproduce it with this code and the keyboard doesn't popup unless I click on the EditText:
B4X:
Sub Globals
   Dim th As TabHost
End Sub

Sub Activity_Create (FirstTime As Boolean)
   th.Initialize("th")
   Dim p1, p2 As Panel
   p1.Initialize("")
   p2.Initialize("")
   Dim b1 As Button
   b1.Initialize("")
   p1.AddView(b1, 10dip, 10dip, 100dip, 100dip)
   Dim et As EditText
   et.Initialize("")
   p2.AddView(et, 10dip, 10dip, 100dip, 100dip)
   th.AddTab2("1", p1)
   th.AddTab2("2", p2)
   Activity.AddView(th, 0, 0, 100%x, 100%y)
End Sub
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
I will test that code from you thanks.
My other post on the tabbed notebook shows the same result.
I am using a xoom for my testing.

Tom
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Just tested your code.
with the xoom on tab 2 the edittext does get the focus and the keyboard comes up. Maybe it is the xoom. If this is the case can I put code in that takes the fosus away from the edittext?

Tom
 
Upvote 0

TomDuncan

Active Member
Licensed User
Longtime User
Hi Erel,
I setup a non visible edittext.
set the tomer for 10 millseconds then put in this
B4X:
Sub TabHost1_TabChanged
   Dim i As Int
   Timer1.Enabled= True
   i = TabHost1.CurrentTab
   Activity.Title= "tab no = "& i & " blocks= " & blocks.Length
   If Built AND (blocks.Length>i) Then
      edtTab.Text = blocks(i)
'      ToastMessageShow(blocks(i),True)
   End If
End Sub

Sub Timer1_Tick
   edtF.RequestFocus
   Timer1.Enabled=False
End Sub
still have the same problem.

Tom
 
Last edited by a moderator:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…