Android Question PreferencesDialog: Start dialog with first field selected and with keyboard activated

Discussion in 'Android Questions' started by Gabino A. de la Gala, Jul 30, 2019.

  1. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed User

    It would be possible to define the possibility that when starting the dialogue the first field would start with all the selected text and activating the keyboard to be able to write directly.

    Already put, could it be done that in the case of B4J to enter the last field simulate the press of the button accept the form?

    Thanks in advance.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.

    Most of the items do not require the keyboard so it is better to implement this feature in your code:
    Code:
    Sub ShowKeyboard(pd As PreferencesDialog, IndexOfItemWithTextField As Int)
       
    Dim tf As B4XFloatTextField = pd.CustomListView1.GetPanel(IndexOfItemWithTextField).GetView(0).Tag
       tf.RequestFocusAndShowKeyboard
       
    Dim et As EditText = tf.TextField
       et.SelectAll
    End Sub

    'Usage example:
    Dim sf As Object = p.ShowDialog(d, "OK""CANCEL")
    ShowKeyboard(p, 
    0'First item is an item with text field
    Wait For (sf) Complete (Result As Int)
     
  3. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed User

    ¿What about the second point of de post?

    Code:
    Already put, could it be done that in the case of B4J to enter the last field simulate the press of the button accept the form?
    Could be?

    The first part works perfectly. Thanks!!!
     
  4. José J. Aguilar

    José J. Aguilar Well-Known Member Licensed User

    Have you tried something like:

    Code:
    Sub TextField2_Action
        Button1_Click
    End Sub


    Sub Button1_Click
        
    Log("Button1 Clicked")
    End Sub
     
    emexes likes this.
  5. Gabino A. de la Gala

    Gabino A. de la Gala Active Member Licensed User

    So easy?. I'll try it!
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    It will not work. The current version doesn't support it.
     
  7. José J. Aguilar

    José J. Aguilar Well-Known Member Licensed User

    Ups, I've tested a single form, I forgot he was talking about PreferencesDialog
     
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