Capitalized sentences in a multiline edit text

lymey

Active Member
Licensed User
Longtime User
I have tried to create a mult-iline EditText that allows the capitalization of sentences. Unfortunately it seems that by using the input type method below, it overwrites the multi-line property.

Can anyone point out where Im going wrong or have a work around for it. I have seen applications that have this ability, so I must be missing something.

Thanks!

B4X:
'Activity module
Sub Process_Globals

End Sub

Sub Globals
   Dim Button1 As Button
   Dim EditText1 As EditText
   Dim Label1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Main")
   EditText1.initialize(EditText1)
   EditText1.SingleLine=False
   Activity.AddView(EditText1, 1, 1, 200, 100)
   Log(EditText1.InputType) 
    
End Sub

Sub Activity_Resume
    EditText1.InputType= Bit.Or(EditText1.INPUT_TYPE_TEXT,  16384)
    Log(EditText1.InputType) 
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub
Sub Button1_Click
   Label1.Text = EditText1.Text & CRLF & Label1.text
End Sub

I am using the reference here
 

NJDude

Expert
Licensed User
Longtime User
Look at the code below:
B4X:
Sub Activity_Resume
    EditText1.InputType= Bit.Or(EditText1.INPUT_TYPE_TEXT,  16384)
    EditText1.Wrap = True '<---- Add this line
    Log(EditText1.InputType)
 End Sub

Also, use DIP when adding views:
B4X:
'Not good
Activity.AddView(EditText1, 1, 1, 200, 100)

'Good!!
Activity.AddView(EditText1, 1dip, 1dip, 200dip, 100dip)

Change this line:

From:
B4X:
EditText1.initialize(EditText1)
To:
B4X:
EditText1.initialize("EditText1")
 
Last edited:
Upvote 0

lymey

Active Member
Licensed User
Longtime User
Capitalizing Multiline text

Thank you!!:sign0060:

I did notice one thing though, the text in the EdiText box became squeezed until it was unrecognizable once the text wrapped to the second line...basically it looked like it was trying to jam it into a single line, so I added EditText1.SingleLine = False and it worked perfectly.

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("Main")
   EditText1.initialize("EditText1")
   Activity.AddView(EditText1, 1dip, 1dip, 200dip, 100dip)
   Log(EditText1.InputType) 
End Sub

Sub Activity_Resume
    EditText1.InputType= Bit.Or(EditText1.INPUT_TYPE_TEXT,  16384)
    EditText1.SingleLine = False
    EditText1.Wrap = True
    Log(EditText1.InputType) 
End Sub
 
Upvote 0
Top