iOS Question I need NEXT button to the keyboard.

Dudi

Member
Licensed User
I am using NUMBER_PAD keyboard type
I added a NEXT button to the keyboard

Also I have 5 TextField
When I press the NEXT button I want to jump between all 5 TextField

I ask the lines of code to execute
 

Attachments

  • key1.png
    key1.png
    69 KB · Views: 476

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Dudi

Member
Licensed User
I have a button.
In order to jump between the lines, i need to press the button.
Every press , the cursor will jump to the next fields.
Please send me a code that I will insert it to the button and after that, every press , the cursor will jump between the fields.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Set the EventName parameter of all fields to TextField.
2. Add them to a list.
3. Set the focus to the next one each time:
B4X:
Sub Process_Globals
   Public App As Application
   Public NavControl As NavigationController
   Private Page1 As Page

   Private TextField1 As TextField
   Private TextField2 As TextField
   Private TextField3 As TextField
   Private TextField4 As TextField
   Private TextField5 As TextField
   Private fields As List
   Private currentIndex As Int
End Sub

Private Sub Application_Start (Nav As NavigationController)
   currentIndex = -1
   NavControl = Nav
   Page1.Initialize("Page1")
   Page1.Title = "Page 1"
   Page1.RootPanel.LoadLayout("1")
   fields = Array(TextField1, TextField2, TextField3, TextField4, TextField5)
   NavControl.ShowPage(Page1)
End Sub

Sub TextField_BeginEdit
   currentIndex = fields.IndexOf(Sender)
End Sub

Sub Button1_Click
   Dim tf As TextField = fields.Get((currentIndex + 1) Mod fields.Size)
   tf.RequestFocus
End Sub
 
Upvote 0
Top