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

Discussion in 'Android Questions' started by vecino, Oct 28, 2013.

  1. vecino

    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.
     
  2. Theera

    Theera Well-Known Member Licensed User

    You could use IME library for helping this. Example as belows
    Code:
    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
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Labels are not "focusable". Why do you want to set the focus on a label?
     
  4. vecino

    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.
     
  5. Erel

    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.
     
  6. vecino

    vecino Well-Known Member Licensed User

    Yes, I am actually doing so.

    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.
     

    Attached Files:

  7. Erel

    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.
     
    vecino likes this.
  8. mc73

    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 likes this.
  9. vecino

    vecino Well-Known Member Licensed User

    Thanks for the tips, I'll try a "ScrollView", as you have advised me.
    Regards.
     
  10. vecino

    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice