Solved

Using multiline Edit Control without flicker?

Posted on 2004-10-14
7
370 Views
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.

thanks
--karthik
0
Comment
Question by:kxr
7 Comments
 
LVL 2

Expert Comment

by:bcsonka
ID: 12313726
Hi,

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:

ceditControl->LineScroll(ceditControl->GetLineCount());

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.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 12316491
m_edit.LockWindowUpdate();
scroll m_edit to last line
m_edit.UnlockWindowUpdate();
0
 

Author Comment

by:kxr
ID: 12324441
andy:
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.

bcsonka:
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?

0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

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

thanks
0
 

Author Comment

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

thanks
--karthik
0
 
LVL 1

Accepted Solution

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

GhostMod
Community Support Moderator
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sumDigits challenge 9 147
if loop in java 3 139
bigDiff challenge 17 105
java ^ examples 8 65
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

774 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