Solved

How can I get an automatic scroll bar on a CEdit Control

Posted on 1997-12-09
6
476 Views
Last Modified: 2013-11-20
I have a CEdit control in my application.  I want it to use
a vertical scroll bar only if necessary.  I was able to find
resources to turn the scroll bar on or off, but this was
independent of how much text was displayed.

I succeeded in getting this automatic scroll bar behavior by
using a CRichEditCtrl.  I set the vertical scroll bar on and
left the disable no scroll off.

Using the CRichEditCtrl seems like overkill for my
application.  Can I get this behavior with CEdit?
0
Comment
Question by:zelda071497
[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
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1311928
Yes, you can use myEdit->ModifyStyle(WS_VSCROLL, 0) to turn off the vertical scroll and myEdit->ModifyStyle(0, WS_VSCROLL) to turn it on.
0
 

Author Comment

by:zelda071497
ID: 1311929
This just turns the scroll bar on or off.  I am looking for something that will automatically turn it on or off depending on how must text is displayed in the control.

Using your suggestion,  I would have to catch an event every time the text was changed and see if the text still fits in the box.
Then I would have to add the scroll bar, if it no longer fit.

Can't this be done automatically, similar to the way the CRichEditCtrl handles this?


0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1311930
What other styles do you have in the edit control?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:zelda071497
ID: 1311931
I have on: visible, tab stop, left align, multiline, no hid selection,
border, and read only.
0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1311932
Do you have ES_AUTOVSCROLL?
0
 

Author Comment

by:zelda071497
ID: 1311933
I have tried ES_AUTOVSCROLL both on and off.  It makes no
difference.  The help for this attribute says:

In a multiline control, Auto VScroll automatically scrolls text up one line when the user presses ENTER on the last line. Type: Bool. Default: False.

So this does not solve my problem.

0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 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