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

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.
 

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:
B4X:
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)
 

Gabino A. de la Gala

Active Member
Licensed User
¿What about the second point of de post?

B4X:
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!!!
 

José J. Aguilar

Well-Known Member
Licensed User
Have you tried something like:

B4X:
Sub TextField2_Action
    Button1_Click
End Sub


Sub Button1_Click
    Log("Button1 Clicked")
End Sub
 
Top