|
-
Nov 6th, 1999, 10:03 AM
#1
Thread Starter
Junior Member
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.
-
Nov 6th, 1999, 10:24 AM
#2
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..
Code:
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
[email protected]
[email protected]
-
Nov 6th, 1999, 10:46 AM
#3
Thread Starter
Junior Member
Thank you Aaron, I have one more question.
How Do I get the insertion point to the far right side of a text?
-
Nov 7th, 1999, 11:10 PM
#4
Text1.Selstart = len(Text1.Text)
Regards,
------------------
Serge
Software Developer
[email protected]
[email protected]
ICQ#: 51055819
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|