Android Question The property "requestFocus" from the "Label" does not work

vecino

Well-Known Member
Licensed User
Hello, the "Label" have the property "RequestFocus", but they ignore.
Is it possible to give focus to a "Label"?

Thanks and regards.
 

Theera

Well-Known Member
Licensed User
You could use IME library for helping this. Example as belows
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("Layout1")
    EditText1.Text=""
    EditText2.Text=""
    TK.Initialize
    ime1.Initialize("IME")
    ime1.ShowKeyboard(EditText1)
    TR.Initialize
End Sub
 

Erel

Administrator
Staff member
Licensed User
Labels are not "focusable". Why do you want to set the focus on a label?
 

vecino

Well-Known Member
Licensed User
Hello, is that the application I'm doing a lot of data needs to ask the user. I find it impossible to do this as standard android keyboard because it is above the "EditText" and had thought of replacing the "EditText" by "label" and use the "click" event to display a dialog with the data that want to edit the user.
In short, I want to simulate a "EditText" with a "label".
I do not know what else I can do.

Greetings.
 

Erel

Administrator
Staff member
Licensed User
So why do you need to "focus" the label? You can handle the label's click event.

Another option is to use the IME library and set the form to appear correctly when the keyboard is visible.
 

vecino

Well-Known Member
Licensed User
So why do you need to "focus" the label? You can handle the label's click event.
Yes, I am actually doing so.

Another option is to use the IME library and set the form to appear correctly when the keyboard is visible.
But that would be moving the "EditText" whenever the keyboard appears to not be hidden?, Do not understand how to do it.
The problem is that there are several dozens of screens (activity) such as in the example. How do you advise me?

Thanks and regards.
 

Attachments

Erel

Administrator
Staff member
Licensed User
You can put load this layout into a ScrollView with its height set to 100%y. In the HeightChanged event increase the ScrollView height and scroll it as needed.
 

mc73

Well-Known Member
Licensed User
You can define a variable containing an integer index of the labels in use. Then increase this, while moving from label to label, create some sort of focus effect (for e.g. altering the background color of the label) and then set your inputDialog accordingly.
Still, I think that the proper way is to continue using editText objects. You just have to load your form to a scrollView, as Erel just mentioned.
 

vecino

Well-Known Member
Licensed User
Thanks for the tips, I'll try a "ScrollView", as you have advised me.
Regards.
 

vecino

Well-Known Member
Licensed User
Oh!! I have been tested, and I think that this solution is not going to be
very functional.
The problem is that I must to "program" all activitys in the main
activity, and I do not want this.

So it will create an main activity of enormous size because each of the
screens/activity represents a table in a database and are several tens. It would be so awful.
I need to take separated by screen/activity so the job would be a little manageable.

Thank you for all your help.

Regards
 
Top