-
Jan 19th, 2021, 07:42 AM
#1
Thread Starter
Member
[RESOLVED] Krool's RichTextBox -Any equivalents for Span and UpTo properties of MS RichTextBox?
Hello,
I was trying out the example code I found here
https://www.daniweb.com/programming/...ox#post1764061
This code works with MS RichTextBox. I couldn't use it with Krool's RichTextBox because the SPAN and UPTO properties are missing.
Krool's control is far more elaborate with 123 properties & methods compared to Microsoft's 83; but to my bad luck, the two I require, are missing.
Can someone suggest a way out ?
Regards,
-
Jan 19th, 2021, 11:22 AM
#2
Thread Starter
Member
Re: Krool's RichTextBox -Any equivalents for Span and UpTo properties of MS RichTextB
I figured it out that GetLine(0) gets the text of the full line where the cursor is presently there.
But, I am still unable to figure out how to set the .SelStart to the beginning of that line.
-
Jan 20th, 2021, 03:14 AM
#3
Thread Starter
Member
Re: [Resolved] Krool's RichTextBox -equivalents for Span and UpTo
I found a workaround here.
Code:
Private Const EM_LINELENGTH = &HC1
Private Const EM_LINEINDEX = &HBB
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 ' generic declaration
Private Sub RichTextBox1_Click()
Dim StartChar As Long
Dim LineLen As Long
StartChar = SendMessage(RichTextBox1.hwnd, EM_LINEINDEX, -1&, 0&)
LineLen = SendMessage(RichTextBox1.hwnd, EM_LINELENGTH, StartChar, 0&)
RichTextBox1.SelStart = StartChar
RichTextBox1.SelLength = LineLen
End Sub
BBo
Basially, I wanted a way to,
a) Select the whole line wherever I click on any line.
b) Get the text of the entire line.
Both the needs are now served.
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
|