Solved

CEdit: How to keep the scroll bar down?

Posted on 2003-12-05
4
1,717 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 23

Expert Comment

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

Expert Comment

by:KurtVon
ID: 9883285
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
ID: 9883290
mMyEditControl.PostMessage(WM_VSCROLL, SB_BOTTOM, 0);
0
 
LVL 2

Author Comment

by:benhere
ID: 9884338
Thanks!
I'll use the PostMessage() method
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

724 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