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

vecino

Well-Known Member
Licensed User
Longtime 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
Longtime 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
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime 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

  • ejemplo.png
    ejemplo.png
    8 KB · Views: 244
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime 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.
 
Upvote 0

vecino

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

vecino

Well-Known Member
Licensed User
Longtime 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
 
Upvote 0
Top