Panel Problem, Focus is going to Previous Panel

margret

Well-Known Member
Licensed User
Longtime User
Guys I need some help. When the program starts and I select to add a new record, the keyboard pops up and has the Next button. As it should. As I press Next it tabs through the fields just as it should. Now I have finished filling in page 1 and click the BtnNxtP button which loads the Panel Layout of my next page. As long as I select each field myself and enter the data all is fine. If I tab using the keyboards Next button, the panel looses focus. Once the cursor is gone if I type a few letters and go back to the first page, my letters are in some other field on the first page. This should not be. How is the focus going through my panel and why does it not follow the tab order of the second page? I hope as I activate the second page, I don't have to add code .Enabled=False for all the Controls on the first page and they set them back Enabled. Any Help Please. The code sniplets are listed below:

Thanks,

Margret

B4X:
Sub Globals
      Dim pnlInput, pnlSelect, PanelMain As Panel 
End Sub

Sub BtnNxtP_Click
   PanPop("entry2.bal", 0, 0)
   If BtnAdd.Text = "Add" Then 
      Efacebook.Text = mface
      Etwitter.Text = mtwit
      Emyspace.Text = mmy
      Eurlwork.Text = murlw
      Eurlpersonal.Text = murlp
      Ebirthday.Text = mbirth
      Eanniversary.Text = mann
      Elikes.Text = mlike
      Edislikes.Text = mdis
      Enotesee.Text = mnotesee
   Else
      Efacebook.Text = ""
      Etwitter.Text = ""
      Emyspace.Text = ""
      Eurlwork.Text = ""
      Eurlpersonal.Text = ""
      Ebirthday.Text = ""
      Eanniversary.Text = ""
      Elikes.Text = ""
      Edislikes.Text = ""
      Enotesee.Text = ""
   End If
   Efacebook.RequestFocus
End Sub

Sub PanPop ( mlayout As String, hc As Int, wc As Int) '( mlayout=your .bal file, hc=height offset + or -, wc=same for width )
   pnlSelect.Initialize ( "Select")      
   pnlInput.Initialize ("")
   pnlInput.LoadLayout ( mlayout )    
   pnlSelect.Color  = Colors.ARGB (150,0,0,0)         
   Activity.AddView (pnlSelect, 0, 0,   100%x, 100%y)   
   mh1=(pnlSelect.Height/2) - (PanelMain.Height/2) + hc
   mw1=pnlSelect.Width/2 - (PanelMain.Width/2) + wc
   mh2=PanelMain.Height
   mw2=PanelMain.Width
   pnlSelect.AddView (pnlInput, mw1, mh1, mw2, mh2)
End Sub

Sub Select_Click ' Stop clicks on Select panel getting to panel underneath
End Sub
 
Last edited:

margret

Well-Known Member
Licensed User
Longtime User
Bad Bug In B4A, Focus Issues

Hello Anyone,

B4A Has a very serious bug. After the issue I listed above and getting no reply, I went ahead and added the code to .Enabled = False to every object on the first page. The same issues still happens. How can an object, manily the EditText box from the first page allow entered text when it in fact is not Enabled to do so? How does a disabled object get focus? This should never happen. Please Help.

Thanks,

Margret
 
Upvote 0

magarcan

Active Member
Licensed User
Longtime User
Hello Anyone,

B4A Has a very serious bug. After the issue I listed above and getting no reply, I went ahead and added the code to .Enabled = False to every object on the first page. The same issues still happens. How can an object, manily the EditText box from the first page allow entered text when it in fact is not Enabled to do so? How does a disabled object get focus? This should never happen. Please Help.

Thanks,

Margret
I hope this could be solved soon :)
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Hello Anyone,

B4A Has a very serious bug. After the issue I listed above and getting no reply, I went ahead and added the code to .Enabled = False to every object on the first page. The same issues still happens. How can an object, manily the EditText box from the first page allow entered text when it in fact is not Enabled to do so? How does a disabled object get focus? This should never happen. Please Help.

Thanks,

Margret

This is not a B4A bug, it is an Android bug. Thread about it here
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Issues / Work-arounds and the core problem

This is not a B4A bug, it is an Android bug. Thread about it here


Please don't read this the wrong way. But try to understand where I am coming from.

That doesn't help me at all. I know that some of the functions documented in B4A are not working as stated. So help me here. What is the work around for B4A. Don't just say it's Android and leave me hanging. I need to complete this and it needs to work right. I can't sell software, or should I say, I won't sell software that don't work right and tell my customers that it's Android. They won't care, they just know what they purchased from me don't work like it should.

So, in B4A what can be done so this works as it should. What are my options please?

Thanks,

Margret
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
Margret,

Please have a little patience, as I said in my PM I am trying to help with this.

The thread I linked to had a workround suggested (by me) that would stop a disabled EditText from accepting new text.

I know of no way of preventing a disabled EditText from getting the focus.

Andy
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
A problem for the REAL experts I think.

I built an activity with 2 panels, each with 2 EditBoxes, and a button to swap between panels:
B4X:
'Activity module
Sub Process_Globals
End Sub

Sub Globals
   Dim Edit1, Edit2, Edit3, Edit4 As EditText 
   Dim Panel1, Panel2 As Panel
   Dim Button1, Button2 As Button 
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Panel1.Initialize ("")
   Panel2.Initialize ("")
   Panel1.Color = Colors.Black 
   Panel2.Color = Colors.Black 
   Edit1.Initialize ("")
   Edit1.SingleLine = True
   Edit2.Initialize ("")
   Edit2.SingleLine = True
   Edit3.Initialize ("")
   Edit3.SingleLine = True
   Edit4.Initialize ("")
   Edit4.SingleLine = True
   Button1.Initialize ("btn1")
   Button1.Text = "Go to panel 2"
   Button2.Initialize ("btn2")
   Button2.Text = "Back to panel 1"
   Panel1.AddView (Edit1,10%x, 10%y, 80%x, 15%y)
   Panel1.AddView (Edit2,10%x, 30%y, 80%x, 15%y)
   Panel1.AddView (Button1, 10%x, 80%y, 80%x, 15%y)
   Panel2.AddView (Edit3,10%x, 10%y, 80%x, 15%y)
   Panel2.AddView (Edit4,10%x, 30%y, 80%x, 15%y)
   Panel2.AddView (Button2, 10%x, 80%y, 80%x, 15%y)
   Activity.AddView (Panel1,0 ,0 ,100%x, 100%y)
   Activity.AddView (Panel2,0 ,0 ,100%x, 100%y)
   Panel1.BringToFront 
   Panel2.Enabled = False
End Sub

Sub Activity_Resume
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

Sub btn1_Click
   Panel2.BringToFront 
   Panel1.Enabled = False
   Panel2.Enabled = True
End Sub

Sub btn2_Click
   Panel1.BringToFront 
   Panel1.Enabled = True
   Panel2.Enabled = False
End Sub

When on panel 1, you can enter text into the top EditText, then when you press "Next" the focus goes to the bottom EditText on panel 2 (the reverse happens on panel 2)

I did a bit of playing and found that if I moved EditText3 and EditText4 (replace lines 31 & 32 with below)
B4X:
   Panel2.AddView (Edit3,10%x, 40%y, 80%x, 15%y)
   Panel2.AddView (Edit4,10%x, 60%y, 80%x, 15%y)
The result was focus would go EditText1 > EditText2 > EditText3 > EditText4, even though Panel2 was not enabled. It appears that the "tab" order is from the top to the bottom of the screen irrespective of panels or their enabled property, is this intended?

I also found that if you hide the back panel (Panel.Visible = false) things work as I would expect.

Anyone got any input?

@ Margret:

A workround is:

Do not load the main layout directly into the activity, load it in to a panel and add the panel to the activity.

In PanPop you should the set the visible property of that panel to false, and set it back to true when you close the pop-up.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Panel Issues

A problem for the REAL experts I think.

I built an activity with 2 panels, each with 2 EditBoxes, and a button to swap between panels:

First off I wanted to say publicly, that no one on this forum has helped or even tried to help like you have. If it was not for you I would still be reading docs and not writing any code. My comment about don't leave me hanging was for the general forum and not directed to you in any way. If anyone here should have any awards, it SHOULD be YOU!! I am so sorry you felt like my message was toward you. You are the BEST, and that I mean! I could of sent a PM, but I wanted it to be clear to all who saw or read this, that it was not to you, just the general fourm. Please know you are GREAT and #1 on here as far as being helpful. So if you were feeling bad about my post, please know I am sorry and don't feel that way.:sign0013:

Your the Best,

Margret
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
You are complaining less than 9 hours after posting a query and having received a reply to your problem! I think your expectations are somewhat out of line with reality. This is a mutual support forum where people voluntarily help others. We are in different time zones scattered round the world and many would not yet have had an opprotunity to even read your post.

The tone of your response seems display a serious attitude problem on your part to the users of this forum. As a result of this you are now on my ignore list.
 
Upvote 0

moster67

Expert
Licensed User
Longtime User
@margret. I think you are exaggerating and that you are way out of line in your complaints, considering this is a community-forum.

Thus, I must agree with Agraham.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
Panel Issues, etc.

@margret. I think you are exaggerating and that you are way out of line in your complaints, considering this is a community-forum.

Thus, I must agree with Agraham.

I agree with both of you, Agraham & moster67, and you are right. I think most of it was the pressure I am under on this side to perform and the fact I haven't been able to produce what they are looking for. I thought when I hit the issue the other day I was stuck for good. Please forgive me for my complaints. If you wish to ignore me I understand and I am sorry.

Thanks,

Margret
 
Upvote 0

latcc

Banned
Margret

You are not out of line with your post. There IS a serious problem here, either with Android or with B4A. Erel says its Android.

I have seen this error myself. It IS a major problem that needs quick fixing for someone. It is quite disatisfying to hear people saying it is normal for Android. What sort of answer is that?

I don't think it matters whether it is an Android or a B4A problem. It works really badly, end of.

I think B4A needs a panel property like Consume=true which would get close a panel and its child views, consuming any child view replies.

As for you complaining. I know you've helped lots of people on this forum so you deserve to have a few frustrated posts IMHO.:sign0098:

Best wishes to you.
 
Upvote 0

timo

Active Member
Licensed User
Longtime User
Instead of making all the views of the panel 'disabled=false' (that doesent reach the goal) it's enough to turn the panel itself 'VISIBLE=false' (all the panels behind the visible one)
 
Upvote 0

Phayao

Active Member
Licensed User
Longtime User
Hello, I got a similar annoying problem when I tried to select an EditText field by setting the focus on it and update my SQL DB when an EditText field looses focus. That worked well but when I added a panel that displays detail information and close the panel again (visibility=false), then always the first EditText box got the focus even another one had the focus before.
Following your advice, I put all EditText views on a panel and set this panel.ENABLED=false before opening the detail panel. Closing it again and set enabled=true again worked - then the original focus stayed. Took me about 3 days to figure that out ;-)
 
Upvote 0
Top