Using multiline Edit Control without flicker?

Posted on 2004-10-14
Medium Priority
Last Modified: 2013-11-20
Hi all,

Is it possible to use an multiline edit control to display messages without the flicker problem? (the edit control should scroll down to display the last added line). A control that will behave like the Output window in visual studio. The usual available methods all have the flicker problem. If we use SetRedraw(false) it does not scroll.

1. How can this be done?
2. How is this done in visual studio?

I dont want to use a list box.

Question by:kxr
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

Expert Comment

ID: 12313726

To answer your questions:

1.) To get rid of the flicker, you should implement multithreading in your program.  If you haven't programmed with multithreading before, this is a good link to start with:  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_multithreading_topics.asp

2.) Once you implement multithreading, whenever you add text to your multi-line CEdit control, call the following method:


This will get rid of the flicker on your dialog and will make your multi-line CEdit control act like the Output window in Visual Studio.

I hope that helps.
LVL 44

Expert Comment

ID: 12316491
scroll m_edit to last line

Author Comment

ID: 12324441
I tried using Lock/Unlock Window update, but it behaves similar to SetRedraw()
I have a loop where I do something and keep updating text in the Edit control. If I use lock/unlock or SetRedraw() it does not scroll one line at a time; the edit control is not refreshed but you can see the scroll bar moving and then after the loop is completed it just shows everything at one shot. note: the redraw(false);scroll;redraw(true) is inside the loop.

I know the build process in visual studio happens in a separate thread, but how do you say this helps avoid the flicker in the edit control?

Get MySQL database support online, now!

At Percona’s web store you can order your MySQL database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card.


Author Comment

ID: 12324451

I am also thinking of trying to post/send a WM_CHAR or keydown to the edit control to see if this will help to avoid the flicker. Does anybody know if this can be done and if it will work.


Author Comment

ID: 12324772
hi all,

SendMessage(WM_CHAR) seems to work a lot better than setting text and scrolling down to the end. The flicker is lot lot less - whatever kind of flicker that is seen is very very less - it is something that you would see if you scroll down real fast.

I dont know if this is THE way to do it but for now this works for me.


Accepted Solution

GhostMod earned 0 total points
ID: 12350641
PAQd, 250 points refunded.

Community Support Moderator

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

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. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

762 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