CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2003
    Location
    SA
    Posts
    147

    Unhappy Upside Down Scrolling ...

    I have read more than 65% of the topics/posts, on scrolling, and views, ect. I could not find my answer ....

    I did attach a picture to explain to you what type of scrolling I would like to have ... eg.

    Instead of the normal RichEditCtrl, with the text starting at the top, I'd rather have the text start at the bottom ...

    Now I've thought of doing this as follows ...

    Insert a few '\n' characters, and keep on adding these characters to the beginning of the text untill the whole RichEditCtrl's text buffer is filled. Now this can be done by calculating the free space, with the font height, and then we now actually know how many "lines" are visible, at the current stage. Also we need to take into account that the actual RichEditCtrl, can be resized, but still keep in mind, the text needs to be displayed at the bottom.

    This does not matter if the control resizes, or not. So it will start "filling" the RichEditCtrl with text, from the bottom upwards.

    As soon as the whole RichEditCtrl's text buffer is full (by saying "text buffer" I mean the client area, the white back ground above text line 1), as soon as the text buffer portion is full, it does not matter, because new text will be added to the end, and be scrolled upwards ...

    How would I go about doing such a thing, anyone know links to posts, or some links to help me resolve this problem ???, or any answers maybe ???

    Thanx in advance ...

    xIRC
    Attached Images Attached Images  
    Last edited by xIRC; September 25th, 2003 at 03:41 PM.

  2. #2
    Join Date
    Mar 2003
    Location
    SA
    Posts
    147

    Does anyone know ...

    Does anyone maybe know how this can be done ?

  3. #3
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    I don't think that it's clear what you want to do and definiately not clear why. It seems that you want the first line of text to appear at the bottom of the edit and as more lines are entered you want to decrease the whitespace above the text. This, espcially in your porposed method of attack, has alot of problems, like there's nothing to prevent the user from clicking in the upper white space area and typing away...

    If the edit is being used for display only (except for the line the user's typing on) you may be able to use two controls to do this. The top control just displays the text at lowest possible point (TotalDisplayLines - textlines; if < 0 then 0) and the bottom control can handle the text entry....
    bytz
    --This signature left intentionally blank--

  4. #4
    Join Date
    Mar 2003
    Location
    SA
    Posts
    147

    Nope ...

    Ok this is one control, a Rich Edit Control ...

    The user can not type in the control, because I will always append the text itself, it's like events that happen in windows, that I wish to logg ..., but as the events happen, these events needs to be placed last in the "queue", and the text should then be shifted upwards.

    Compare picture one with two, one is the default way text gets appended to a rich edit control, and I wish to do it like in picture two. First making the text visible as it arrives, but at the bottom of the rich edit control, and as events happen, I wish to add them beneath text line 1, and then shift text line 1 upwards ...

    These pictures are attatched ...

    Hope you understand ... ?

    Thanx in advance ...

    xIRC
    Attached Images Attached Images  

  5. #5
    Join Date
    Sep 2002
    Location
    DC Metro Area, USA
    Posts
    1,509
    Ok then, your solution should work. You'll need to determine the number of lines that the edit can display, probably the control height/ the font height should give a reasonable start vaule. Add that number of blank lines and remove the topmost as lines are added -- or you could just leave the blank lines there and set the insertion point at the last character of the last line entered or scroll to the last line entered....
    bytz
    --This signature left intentionally blank--

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