Solved

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

Posted on 1997-12-09
6
456 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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…

760 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

22 Experts available now in Live!

Get 1:1 Help Now