Results 1 to 12 of 12

Thread: Stop RTB from beeping

  1. #1
    imbue
    Guest

    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.

  2. #2
    Member mafia_geek's Avatar
    Join Date
    Jan 2002
    Location
    California
    Posts
    45
    is it a windows beep or a pc speaker beep?
    -mafia_geek-

    Condito, Ergo Sum

  3. #3
    imbue
    Guest
    It's the window's beep.

  4. #4
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    VB Code:
    1. Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
    2.  
    3.     If KeyCode = 40 Then KeyCode = 0
    4.  
    5. End Sub

    Regards...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  5. #5
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    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.

  6. #6
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    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 ...
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  7. #7
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    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.

  8. #8
    Frenzied Member zuperman's Avatar
    Join Date
    Dec 2000
    Location
    Portugal
    Posts
    1,033
    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
    Help keep this forum clean: Remember to mark your thread as resolved · Search before you post · Remember to rate posts that help

    VS2010: Visual Studio 2010 Keybinding Posters
    · Service Pack 1
    Tools: GhostDoc - automatically generates XML documentation comments
    · NuGet package Manager · PowerCommands IDE extensions
    Source Control: ankhsvn - integration for SVN
    · Windows Shell Extension for Subversion

    Development Laptop: Intel Core i5 430M 2.26 GHz @ 2.53 GHz
    · 4096 MB, DDR3 PC3-8500F (533 MHz), Kingston · ATI Mobility Radeon HD 5470 · 15.6 @ 16:9, 1366x768 pixel, HD LED LCD

    I follow:
    JoelOnSoftware - A weblog by Joel Spolsky, a programmer working in New York City, about software and software companies
    ScottGu's Blog - Scott Guthrie works for Microsoft as the Product Manager of the .NET Framework
    Portugal-a-Programar - Portuguese Developers Community
    .NET Rocks! - is a weekly Internet audio talk show for .NET Developers.

    Programming Languages:
    C#
    · VB.NET · JAVA · PHP · Javascript
    Other:
    XML
    · HTML · CSS · JQuery · SQL



    *** Proudly Portuguese ***

  9. #9
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    I think, I will spend my hangover-Sunday looking into that, haha.

  10. #10
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    I think, I will spend my hangover-Sunday looking into that, haha.

  11. #11
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    sample u wanted HaxSoft
    VB Code:
    1. Option Explicit
    2.  
    3. 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
    4.  
    5. Private Const EM_GETLINECOUNT = &HBA
    6.  
    7.  
    8. Private Sub RichTextBox1_Change()
    9.     Dim lineCount As Long
    10.     On Local Error Resume Next
    11.  
    12.     lineCount = SendMessageLong(RichTextBox1.hwnd, EM_GETLINECOUNT, 0&, 0&)
    13.     Label1 = Format$(lineCount, "##,###")
    14. End Sub
    -= a peet post =-

  12. #12
    Fanatic Member HaxSoft's Avatar
    Join Date
    May 2000
    Location
    Ohio
    Posts
    593
    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
  •  



Click Here to Expand Forum to Full Width