|
-
Jul 26th, 2000, 02:51 PM
#1
Thread Starter
Lively Member
How can I subclass a Richtextbox control's keydown and mouse click events? I want to call a functions when these events occur, then pass the events on, not cancel them.
Any ideas?
REM
"Innovate, don't immitate."
-
Jul 26th, 2000, 04:44 PM
#2
Why would you need to subclass the RichTextbox if this control already has all events setup and ready for you:
Code:
Private Sub RichTextBox1_KeyPress(KeyAscii As Integer)
'call your function here for KeyPress event
End Sub
Private Sub RichTextBox1_KeyUp(KeyCode As Integer, Shift As Integer)
'call your function here to handle function keys also
'i.e F1 to F12, Insert, Home etc
End Sub
Private Sub RichTextBox1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
'call your function here for mouse click
End Sub
-
Jul 27th, 2000, 12:38 PM
#3
Thread Starter
Lively Member
Thanks Serge
I understand what you are saying Serge, but I am having trouble keeping certain values 'up to date' in my program. I am developing an class that preforms just like the VB Code development area - colours text (colours line black when it gets focus, parses that line when you leave that line etc.
I am storing positions such as 'previous line start position', 'previous line end position', 'previous cursor position' in the class, and these are updated by a sub if the line changes or the cursor position changes.
I am having trouble at the moment getting the values updated, but your code has helped a little, as I moved my call to the class' update function to the Keyup and mouseup events. I hope u know what i mean 
Anyway, I will have another look at my code and work it until i get it right. I just thought I could subclass the control to get when the control changed so i could update immediately, but i understand what you are saying.
Thank you for your help.
REM
"Innovate, don't immitate."
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
|