Android Question Set focus and show keyboard on B4XPrefDialog

pliroforikos

Active Member
Licensed User
Please, i need help to set focus and show keyboard on a text field on B4XPreferenceDialog when i call it.
It is very simple dialog with only one text field

What i have done until now:
   Dim prefDialog As PreferencesDialog
    Dim Title As String = "Search "
    Dim searchResults As Map
    searchResults.Initialize
  
    prefDialog.Initialize(Root, Title, 300dip, 120dip)
    prefDialog.LoadFromJson(File.ReadString(File.DirAssets, "search_name.json"))
    Dim pDlg As Object = prefDialog.ShowDialog(searchResults, "OK", "Cancel")
   
    Dim i As Int = prefDialog.PrefItems.IndexOf(prefDialog.GetPrefItem("srchText"))
    Dim pnl As B4XView = prefDialog.CustomListView1.GetPanel(i)
    Dim txtFld As B4XView = pnl.GetView(0)
    Dim ime As IME
    ime.Initialize("IME")
    ime.ShowKeyboard(txtFld)     'txtFld gets the focus without showing keyboard
   
    Wait For (pDlg) Complete (Result As Int)


    If Result = xui.DialogResponse_Positive Then
    ....
    end if

and json file
{
"Version": 1.65,
"Theme": "Light Theme",
"Items": [
{
"title": "srchText",
"type": "Text",
"key": "srchText",
"required": true
}
]
}
 
Last edited:
Top