I'm making an app that allows the user to easily write words/phrases/sentences in phonemes. I made a series of buttons and put a picture of the phoneme on each one and copied the SIL Manuscript character for that symbol into the Tag property of the buttons. When a button is pressed, that symbol is appended to the end of the text string in the RichTextBox at the top.Attachment 95209
All goes well if the user types everything correctly first time - not likely! The user can click in the RichTextBox but then clicking a button still appends the symbol at the end. The only way is to use [BS] to delete the symbols to the correct point and then continue.
What I would like is some way of detecting the point in the RichTextBox that the user clicks and then insert subsequent characters at that point.
For interest, the code I have at present is below. Can anyone point me in the right direction please.
All goes well if the user types everything correctly first time - not likely! The user can click in the RichTextBox but then clicking a button still appends the symbol at the end. The only way is to use [BS] to delete the symbols to the correct point and then continue.
What I would like is some way of detecting the point in the RichTextBox that the user clicks and then insert subsequent characters at that point.
For interest, the code I have at present is below. Can anyone point me in the right direction please.
vb.net Code:
Public Class frmPhoneme Private Sub PhonemePress(sender As System.Object, e As System.EventArgs) Handles Button1.Click, Button2.Click, Button3.Click, Button4.Click, Button5.Click, Button6.Click, Button7.Click, Button8.Click, Button9.Click, Button10.Click, Button11.Click, Button12.Click, Button13.Click, Button14.Click, Button15.Click, Button16.Click, Button17.Click, Button18.Click, Button19.Click, Button20.Click, Button21.Click, Button22.Click, Button23.Click, Button24.Click, Button25.Click, Button26.Click, Button27.Click, Button28.Click, Button29.Click, Button30.Click, Button31.Click, Button32.Click, Button33.Click, Button34.Click, Button35.Click, Button36.Click, Button37.Click, Button38.Click, Button39.Click, Button40.Click, Button41.Click, Button42.Click, Button43.Click, Button44.Click, Button48.Click, Button50.Click, Button51.Click Dim Btn As Button = DirectCast(sender, Button) RichTextBox1.Text += Btn.Tag.ToString End Sub Private Sub Button46_Click(sender As System.Object, e As System.EventArgs) Handles Button46.Click RichTextBox1.Text = "" End Sub Private Sub Button49_Click(sender As System.Object, e As System.EventArgs) Handles Button49.Click Me.Close() End Sub Private Sub Button47_Click(sender As System.Object, e As System.EventArgs) Handles Button47.Click Clipboard.SetDataObject(RichTextBox1.Text, True) End Sub Private Sub RichTextBox1_Click(sender As Object, e As System.EventArgs) Handles RichTextBox1.Click End Sub Private Sub RichTextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles RichTextBox1.TextChanged End Sub End Class