Android Question B4XInputTemplate ENTER behaviour

advansis

Active Member
Licensed User
Longtime User
Hi, all.
I use an InputTemplate to insert a multiline text.
When I press the New-Line (Enter) button on IME the dialog closes (even if a new line is added to the result).
I just would like to add new lines to the string... any ideas? Thanks a lot

This is my code...

Settings:
Dim dlg As B4XDialog
Dim tinput As B4XInputTemplate

    [...]

    Sub AskText(root As B4XView,caption As String,value As String,minlen As Int) As ResumableSub
    If dlg.IsInitialized=False Then dlg.Initialize(root)
    If tinput.IsInitialized=False Then tinput.Initialize
    tinput.mBase.Height=40%y
    tinput.lblTitle.Text=caption
    Dim ef As EditText=tinput.TextField1
    ef.SingleLine=False
    ef.Height=35%y
    ef.Gravity=Bit.Or(Gravity.TOP,Gravity.LEFT)
    ef.InputType=Bit.Or(ef.INPUT_TYPE_TEXT,0x20000) ' TYPE_TEXT_FLAG_MULTI_LINE + TYPE_CLASS_TEXT
    ef.ForceDoneButton = False
    tinput.Text=value
    wait for (dlg.ShowTemplate(tinput,"OK","","Cancel")) Complete (res As Int)
    If res=xui.DialogResponse_Positive Then
        Return tinput.text
    End If
    Return ""
End Sub
 
Top