• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 404
  • Last Modified:

Using multiline Edit Control without flicker?

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
kxr
Asked:
kxr
1 Solution
 
bcsonkaCommented:
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
 
AndyAinscowCommented:
m_edit.LockWindowUpdate();
scroll m_edit to last line
m_edit.UnlockWindowUpdate();
0
 
kxrAuthor Commented:
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
kxrAuthor Commented:

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
 
kxrAuthor Commented:
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
 
GhostModCommented:
PAQd, 250 points refunded.

GhostMod
Community Support Moderator
0

Featured Post

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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now