J Juzer Hussain Active Member Licensed User Longtime User May 8, 2022 #1 Hi, I need to insert line break at cursor location in edit text. I dont know how to know the current cursor location. Can anyone give a clue. Thanks Juzer
Hi, I need to insert line break at cursor location in edit text. I dont know how to know the current cursor location. Can anyone give a clue. Thanks Juzer
MicroDrie Well-Known Member Licensed User May 8, 2022 #2 Can you give use a clue about the component with the edit text? A small code example will help. Upvote 0
J Juzer Hussain Active Member Licensed User Longtime User May 9, 2022 #3 Its like user is editing long text in edittext at many places he wants to start new line. I want to give a button to click which will insert line break character at the cursor position. Upvote 0
Its like user is editing long text in edittext at many places he wants to start new line. I want to give a button to click which will insert line break character at the cursor position.
klaus Expert Licensed User Longtime User May 9, 2022 #4 You can use something like this: B4X: Sub btnInsertLF_Click Private txt1, txt2 As String txt1 = txt.SubString2(0, edtText.SelectionStart) txt2 = txt.SubString(edtText.SelectionStart) txt = txt1 & CRLF & txt2 edtText.Text = txt Log(edtText.SelectionStart) End Sub Upvote 0
You can use something like this: B4X: Sub btnInsertLF_Click Private txt1, txt2 As String txt1 = txt.SubString2(0, edtText.SelectionStart) txt2 = txt.SubString(edtText.SelectionStart) txt = txt1 & CRLF & txt2 edtText.Text = txt Log(edtText.SelectionStart) End Sub
J Juzer Hussain Active Member Licensed User Longtime User May 9, 2022 #5 Thank You KLAUS, Nenver knew this property SelectionStart Upvote 0