Solved

Using multiline Edit Control without flicker?

Posted on 2004-10-14
7
367 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 107
dog bark java program 15 87
mapAB Challlenge 35 128
Is there a simple front-end menu system. 9 71
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

21 Experts available now in Live!

Get 1:1 Help Now