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
Solved

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

Posted on 1997-12-09
6
464 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
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 133
substring method in java 1 130
Hibernate methods 2 77
Way to decrease size of apk file 9 87
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…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

829 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