CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    95

    very strange rtb operation

    I am trying to write a routine that wll append new text to an rtb:

    AppendRTB(theText, theColor) which will just ad to the text already present & also color the new text as desired (not touching anything from earlier).

    I thought I had it working, then noticed that in cases when my text had a cr lf in it, I GET a totally skipped line (eg: a blank line appears from nowhere in between)
    instead of:

    hello how are you
    mr jellyfish

    ---get-----
    hello how are you
    <<<----blank line
    mr jellyfish

    =====================
    if I do something like rtbmsg.text = rtbmsg.text & newtext the appending is proper, but all colorization is lost. I searched and found this strips out some hidden formatting provision.

    IF I DO rtbmsg.seltext = rtbmsg.seltext & newtext (as I was doing in my program) by itself it appends properly!!!! however no color is being set by this single line

    In order to set the color, my understanding is you need to select the start position & length of text to colorize.

    JUST BY ADDING THE FOLLOWING single code LINE I GO BACK TO THE IMPROPER APPENDING!!!

    oldlen =len(rtbmsg)
    rtbmsg.seltext = rtbmsg.seltext & newtext
    rtbmsg.selstart=oldlen '<===causes blankl line skipping !!!!!

    Why would simply setting up a start position, suddenly cause this extra line skipping to happen?!!!??? does this modiy the the text at all?? It should just mark a position!! I can (and have) add a few more lines of code to change the color as desired, but I do not want the line skipping

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: very strange rtb operation

    Don't post twice
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Featured