Joe Bob
Nov 6th, 1999, 09:03 AM
How do I tell what Text is being edited?
---when I say edited I mean when the insert point is in the text and you can add or delete characters.---
I want to know what text is being edited so It will change some characters around in the text that the user is editing in.
Aaron Young
Nov 6th, 1999, 09:24 AM
You can get the Current Line of Text st the Caret Postion using the SendMessage API, eg.
In a Form with 2 Textboxes, Text is Multiline, Text2 is Normal..
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const EM_GETLINE = &HC4
Private Const EM_LINEFROMCHAR = &HC9
Private Const EM_LINELENGTH = &HC1
Private Sub Command1_Click()
Dim lLine As Long
Dim lLen As Long
Dim sLine As String
lLine = SendMessage(Text1.hwnd, EM_LINEFROMCHAR, -1, 0&)
lLen = SendMessage(Text1.hwnd, EM_LINELENGTH, Text1.SelStart, 0&)
sLine = Space(lLen)
Call SendMessage(Text1.hwnd, EM_GETLINE, lLine, ByVal sLine)
Text2 = sLine
End Sub
------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net
Joe Bob
Nov 6th, 1999, 09:46 AM
Thank you Aaron, I have one more question.
How Do I get the insertion point to the far right side of a text?
Serge
Nov 7th, 1999, 10:10 PM
Text1.Selstart = len(Text1.Text)
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819