Solved

Using multiline Edit Control without flicker?

Posted on 2004-10-14
7
379 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
[X]
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
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

739 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