Link to home
Start Free TrialLog in
Avatar of mahfudz
mahfudz

asked on

auto scrolling down to the end in edit box

hi

i have an edit box control....which acts like some status box.....constantly filled with text

problem is the scroll bar does not automatically move, anyone knows the solution? thanks!
Avatar of krbatge
krbatge

Whenever you add 1 or more lines of text call LineScroll() and scroll to the last line of the edit control.  

For example if you have a pointer to an your edit box called pEdit try calling

    pEdit->LineScroll(pEdit->GetLineCount());

whenever you add a new status message to it
> pEdit->LineScroll(pEdit->GetLineCount());

This code will only ever show the last line as the top line in the edit box.

You can do something like this to show the last 10 lines:

int nFirstVisible = pmyEdit->GetFirstVisibleLine();
pmyEdit->LineScroll(pmyEdit->GetLineCount()-nFirstVisible-10, 0);

ASKER CERTIFIED SOLUTION
Avatar of AlexFM
AlexFM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial