Android Question disable enter key to close in B4XInputTemplate

Binary01

Active Member
Licensed User
Longtime User
Hi,

I want a multiline text input in my app. So I use B4XinputTemplate.

B4X:
InputTemplate.Initialize
InputTemplate.TextField1.TextColor = XUI.Color_Black
InputTemplate.TextField1.SetTextAlignment("TOP", "LEFT")
InputTemplate.mBase.Height = 200dip
Dim et As EditText = InputTemplate.TextField1
et.SingleLine = False
et.Height = 150dip

Multiline text is ready with dialog. But when I type text and press enter key, the dialog is close. I want enter key for new line in my input dialog and I click ok to close input dialog.
How can I do it in B4XinputTemplate?
 
Last edited:

Mahares

Expert
Licensed User
Longtime User
How can I do it in B4XinputTemplate?
It works as expected. The enter key on the keyboard moves you to the next line. Your code is good
1644679108869.png
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
When I press the enter key on the keyboard, the dialog is close.

Here is the full code I used. Most of it is yours and it worked for me
B4X:
Sub Globals
    Private Dialog As B4XDialog   'need XUI Views lib checked
    Private XUI As XUI
    Private InputTemplate As B4XInputTemplate
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Dialog.Initialize (Activity)
    InputTemplate.Initialize
    InputTemplate.TextField1.TextColor = XUI.Color_Black
    InputTemplate.TextField1.SetTextAlignment("TOP", "LEFT")
    InputTemplate.mBase.Height = 200dip
    Dim et As EditText = InputTemplate.TextField1
    et.SingleLine = False
    et.Height = 150dip
    et.TextColor=XUI.Color_Cyan

    Wait For (Dialog.ShowTemplate(InputTemplate, "OK", "", "CANCEL")) Complete (Result As Int)
    If Result = XUI.DialogResponse_Positive Then
        Log(InputTemplate.Text)
    End If
End Sub
 
Upvote 0

Binary01

Active Member
Licensed User
Longtime User
Thank Mahares,
My problem is my phone customized keyboard. I change phone default keyboard. The problem is solve. It work well.
 
Upvote 0
Top