|
-
May 4th, 2006, 04:41 PM
#1
Thread Starter
Member
[RESOLVED] How To Change Caret (Insertion) Cursor?
Hi. I know this must be simple, but I've spent a few hours searching, reading and experimenting with no joy. So, can one of you please point me in the right direction.
I have a form with multiple text boxes. When the form loads, I wan't the insertion point, (or caret), to be a "solid block."
I have most of it working. The form loads properly, and the insertion point will go to the next, or first available free text box. So, I'm good to go on that part of the code. However, I'm stuck with how to get the insertion point, ( or caret), to show up as a block.
So, if someone could help me with how to change the insertion point caret to be a block I would REALLY appreciate it.
Thank you in advance for any suggestions.
bjmarler
-
May 4th, 2006, 10:28 PM
#2
Frenzied Member
Re: How To Change Caret (Insertion) Cursor?
VB Code:
Private Declare Function CreateCaret Lib "user32" (ByVal hwnd As Long, ByVal hBitmap As Long, ByVal nWidth As Long, ByVal nHeight As Long) As Long
Private Declare Function ShowCaret Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function DestroyCaret Lib "user32" () As Long
Private Sub Text1_GotFocus()
DestroyCaret
CreateCaret Text1.hwnd, 0, 8, 14
ShowCaret Text1.hwnd
End Sub
Private Sub Text1_LostFocus()
DestroyCaret
End Sub
You may have to do some more code to activate the caret change like when the form loses the focus and then gets it back, the gotfocus isn't called right.
-
May 5th, 2006, 06:29 AM
#3
Re: How To Change Caret (Insertion) Cursor?
Do you mean you just want something like this:
VB Code:
Private Sub Text1_GotFocus()
Text1.SelStart = 0 'this may need to be 1 (can't remember)
Text1.SelLength = Len(Text1.Text)
End Sub
-
May 5th, 2006, 08:44 AM
#4
Thread Starter
Member
Re: How To Change Caret (Insertion) Cursor?
Thanks numtel, that is EXACTLY what I was wanting to do. Perfect. Thanks again.
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
|