Solved

CEdit: How to keep the scroll bar down?

Posted on 2003-12-05
4
1,708 Views
Last Modified: 2013-11-20
Hi,

I have a multiline CEdit control with a vertical scroll bar.
I am appending strings in it and I want the scroll bar to be always down.

Here's the code I have, which does not work:

int lMinPos;
int lMaxPos;

mMyEditControl.GetScrollRange( SB_VERT, &lMinPos, &lMaxPos );
mMyEditControl.SetScrollPos( lMaxPos, TRUE );


What can I do to make it work?
Thanks!
0
Comment
Question by:benhere
4 Comments
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
Use the function SetSel of CEdit with bNoScroll with TRUE.
0
 
LVL 11

Expert Comment

by:KurtVon
Comment Utility
If you don't want to mess with the current selection, you can also use LineScroll to scroll the edit control.  You can use GetFirstVisibleLine and GetLineCount to make sure it scrolls the last line into view.

Hope this helps.


0
 
LVL 48

Accepted Solution

by:
AlexFM earned 200 total points
Comment Utility
mMyEditControl.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
0
 
LVL 2

Author Comment

by:benhere
Comment Utility
Thanks!
I'll use the PostMessage() method
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Running shell command from Access 3 63
Unix / Linux grid computing 5 125
Process filename extension 3 156
dog bark java program 15 81
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now