Results 1 to 5 of 5

Thread: Richtextbox setting focues on character

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    Holland
    Posts
    47

    Red face Richtextbox setting focues on character

    I have a richtextbox.

    I print certain logging information in it.

    The problem is that the textbox doesn't automaticly scrolldown when I print text in it.

    I now there is a way to do that. I've read it somewhere before but I can't seem to find it using Google.

    Could someone help me out?

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    VB Code:
    1. With RTF
    2.     .SelStart = Len(.Text)
    3. End With

    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    Holland
    Posts
    47
    Thank you very much for the real fast reply

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333
    In addition, there are a variety of ways to scroll both a standard text box and a richtextbox using the SendMessage API. Here is an example along with various scrolling messages that can be sent to the box.
    VB Code:
    1. 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
    2.  
    3. Private Const EM_SCROLL = &HB5
    4. Private Const SB_PAGEDOWN = 3
    5.  
    6. Private Sub RichTextBox1_Change()
    7. SendMessage RichTextBox1.hwnd, EM_SCROLL, SB_PAGEDOWN, ByVal 0&
    8. End Sub
    9.  
    10. 'Other parameters
    11. Private Const SB_BOTTOM = 7
    12. Private Const SB_LEFT = 6
    13. Private Const SB_LINEDOWN = 1
    14. Private Const SB_LINELEFT = 0
    15. Private Const SB_LINERIGHT = 1
    16. Private Const SB_LINEUP = 0
    17. Private Const SB_PAGEDOWN = 3
    18. Private Const SB_PAGELEFT = 2
    19. Private Const SB_PAGERIGHT = 3
    20. Private Const SB_PAGEUP = 2
    21. Private Const SB_RIGHT = 7
    22. Private Const SB_THUMBPOSITION = 4
    23. Private Const SB_THUMBTRACK = 5
    24. Private Const SB_TOP = 6
    25. Private Const SB_ENDSCROLL = 8

  5. #5

    Thread Starter
    Member
    Join Date
    Sep 2002
    Location
    Holland
    Posts
    47
    Originally posted by Hack
    In addition, there are a variety of ways to scroll both a standard text box and a richtextbox using the SendMessage API. Here is an example along with various scrolling messages that can be sent to the box.
    VB Code:
    1. 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
    2.  
    3. Private Const EM_SCROLL = &HB5
    4. Private Const SB_PAGEDOWN = 3
    5.  
    6. Private Sub RichTextBox1_Change()
    7. SendMessage RichTextBox1.hwnd, EM_SCROLL, SB_PAGEDOWN, ByVal 0&
    8. End Sub
    9.  
    10. 'Other parameters
    11. Private Const SB_BOTTOM = 7
    12. Private Const SB_LEFT = 6
    13. Private Const SB_LINEDOWN = 1
    14. Private Const SB_LINELEFT = 0
    15. Private Const SB_LINERIGHT = 1
    16. Private Const SB_LINEUP = 0
    17. Private Const SB_PAGEDOWN = 3
    18. Private Const SB_PAGELEFT = 2
    19. Private Const SB_PAGERIGHT = 3
    20. Private Const SB_PAGEUP = 2
    21. Private Const SB_RIGHT = 7
    22. Private Const SB_THUMBPOSITION = 4
    23. Private Const SB_THUMBTRACK = 5
    24. Private Const SB_TOP = 6
    25. Private Const SB_ENDSCROLL = 8
    Thank you!

    That might come in handy in a other situation!

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