Solved

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

Posted on 1997-12-09
6
460 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Turn a spreadsheet into a vba executable. 2 78
maxBlock challenge 30 111
MaxSpan challenge 9 79
Is there a simple front-end menu system. 9 69
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. …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

947 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

19 Experts available now in Live!

Get 1:1 Help Now