|
-
Feb 22nd, 2002, 04:25 PM
#1
Stop RTB from beeping
If you scroll to the bottom of a richtextbox and hold the down arrow key the RTB beeps to tell you you can't scroll down any farther. Is there any way to keep it from beeping.
-
Feb 22nd, 2002, 04:38 PM
#2
Member
is it a windows beep or a pc speaker beep?
-
Feb 22nd, 2002, 05:06 PM
#3
-
Feb 22nd, 2002, 05:12 PM
#4
Frenzied Member
VB Code:
Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 40 Then KeyCode = 0
End Sub
Regards...
-
Feb 22nd, 2002, 05:20 PM
#5
Fanatic Member
Very good, BUT
I find (after trying the code) that I can't scroll down using the arrow key AT ALL, no matter where I am.
I suppose you would have to modify the code such that it only intercepts key code 40 IF and ONLY IF the cursor is on the last line of the RTF box.
Is there anyone that knows how to kill this beep using an API call? I have a gut feeling that we just need a SEND_MESSAGE thing to achieve this.
Very good try, though zuperman, but just not quite good enough.
-
Feb 22nd, 2002, 05:30 PM
#6
Frenzied Member
Originally posted by HaxSoft
Very good try, though zuperman, but just not quite good enough.
yep, i think you are right, I didn't think about that possibility ...
-
Feb 22nd, 2002, 05:47 PM
#7
Fanatic Member
Just for the sake of argument: Suppose we could get the width of each line in the RTF box (we can find its width in pixels and the font and the width of the text).
That information should be sufficient to determine whether we are at the last line. IF so, then we implement the code you suggested. Otherwise, key 40 (Down Arrow) is enabled.
Just a thought. I don't really have time to experiment with this right now, but it's interesting nonetheless.
-
Feb 22nd, 2002, 05:50 PM
#8
Frenzied Member
Originally posted by HaxSoft
Just for the sake of argument: Suppose we could get the width of each line in the RTF box (we can find its width in pixels and the font and the width of the text).
That information should be sufficient to determine whether we are at the last line. IF so, then we implement the code you suggested. Otherwise, key 40 (Down Arrow) is enabled.
Just a thought. I don't really have time to experiment with this right now, but it's interesting nonetheless.
Friday, i not in the mood to do that, but... good idea
-
Feb 22nd, 2002, 05:53 PM
#9
Fanatic Member
I think, I will spend my hangover-Sunday looking into that, haha.
-
Feb 22nd, 2002, 06:00 PM
#10
Fanatic Member
I think, I will spend my hangover-Sunday looking into that, haha.
-
Feb 22nd, 2002, 06:15 PM
#11
-= B u g S l a y e r =-
sample u wanted HaxSoft
VB Code:
Option Explicit
Private Declare Function SendMessageLong Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Const EM_GETLINECOUNT = &HBA
Private Sub RichTextBox1_Change()
Dim lineCount As Long
On Local Error Resume Next
lineCount = SendMessageLong(RichTextBox1.hwnd, EM_GETLINECOUNT, 0&, 0&)
Label1 = Format$(lineCount, "##,###")
End Sub
-
Feb 22nd, 2002, 06:28 PM
#12
Fanatic Member
Tried it out ... it works like a charm. Thanks a million. Although it's not really MY problem, I really really wanted to know.
You're cool dude.
ALTHOUGH -- getting demanding now.... I also need to know which line the caret (insertion point [or cursor]) is currently at. If I don't get info, zuperman's suggested solution won't work.
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
|