Android Question Reqestfocus Does not work

Devendra

Member
Licensed User
Longtime User
The requestforcus for the does not get focused, It goes to the event and get lost ( Focus Goes off ), Please explain, Please find below the coding

If c2=0 AND b2=0 Then
CIqty.RequestFocus
Else If c2=0 AND b2=1 Then
CIbatchNo.RequestFocus
Else
CIitmColor.RequestFocus
End If
 

Devendra

Member
Licensed User
Longtime User
Sorry Even this does not work, I called it in the sub

CallSubDelayed(Me,"GotoItemNo")

Sub GotoItemNo
CIitemNo.RequestFocus
End Sub

Please correct me if i am wrong
 
Upvote 0

Devendra

Member
Licensed User
Longtime User
Please find the attached it goes above the other focus
 

Attachments

  • TestProgrameRequestFocus.zip
    7 KB · Views: 86
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Please find the attached it goes above the other focus
Can you describe it more clearly please? I did not understand what actually the problem is i should "see" in your code
 
Upvote 0

Devendra

Member
Licensed User
Longtime User
There is no CallSubDelayed calls in the code you posted.

Delete all your code and change it to:
B4X:
Sub EditText4_EnterPressed
   EditText1.RequestFocus
End Sub

No i have to focus the different edittext boxes based on the code bassed on the customers input, I cannot focus them as the way i want

i tried the CallSubDelayed as well which did not work, If you want i can send the bal file i created for this,

When we push from the exdittext4 to edittext1 it will be focused to edittext2 this is my issue.
 
Upvote 0

Devendra

Member
Licensed User
Longtime User
I don't understand why you don't understand this, All what i ant to do is to Request the forcus to the Edittext box what i want to based on the users input in my project, I think i will have to put that also to the BUG list in B4A, Your request focus event does not properly work i believe. from the first edittext box in my sample to the 4th run the code and see whether they correctly get the focus on. If you are really keen in knowing the issue you can see the coding in my POS application i am having lots of trouble in this scenario, request focus does not focus or Callsubdely is also not applying properly.

Sorry but I will not check it again. is not a good answer i believe. SInce you are are staff member of the B4A.
 
Upvote 0

Informatix

Expert
Licensed User
Longtime User
Please find the attached it goes above the other focus
Erel is absolutely right and the problem is that you did not prove that something was wrong with RequestFocus, so you should check again your code.
Copy and paste this code in your example (post #7) and you'll see that you jump to the 3rd EditText when you press Next:
B4X:
Sub DelayedTo3
    EditText3.RequestFocus
End Sub

Sub EditText1_EnterPressed
    CallSubDelayed(Me, "DelayedTo3")
End Sub
If that does not work for you, then you have probably a problem with your device.
 
Upvote 0
Top