Re: How to display a text file dynamically?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Take a look at my Logging Listbox on my MVP Tips site. It might give you some ideas (feel
free to use as much of the code as you want).
joe

On Sun, 28 Oct 2007 22:17:49 -0700, decentjohn@xxxxxxxxx wrote:

On Oct 29, 12:28 am, Joseph M. Newcomer <newco...@xxxxxxxxxxxx> wrote:
As demonstrated in my Locale Explorer and in my PowerPoint Indexer, you can do an
owner-draw control and get boldface, colors, or anything else you want in a CListBox or
CListCtrl. There are even documents that show the algorithms. You can also do word-wrap
if you do an owner-draw-variable control.

I urge avoiding the edit control entirely. It is slow, bulky, and intractable for this
purpose.
joe

On Sun, 28 Oct 2007 20:52:12 -0400, "Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp>
wrote:





<decentj...@xxxxxxxxx> wrote in message
news:1193599967.946752.180660@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I need to show a large text file ( <10M) to users in a dialog.
Meanwhile, the file is being appened with more data by a seperate
process.

I have little experience with MFC. I guess I should use RichEditCtrl
for this case. But I'm not sure if I should use SetDlgItemText(..) to
send file content to the control. This is Question 1.

Secondly, I'd like send only the newly appended part of the file to
the control for every refresh, instead of the whole file everytime.
Are there any existing functions/mechanisms in MFC for this purpose?

If you need the control to do word-wrap for you at the end of lines then use
the edit control. Or if you need the ability to change colors and fonts in
different parts of the text use the rich edit control.

But if you don't need either of these features then the list box is a much
easier way to display scrolling lines of text.

The control's features are the same whether you use MFC or not. MFC just
provides a convenient wrapper around the Win32 control's SendMessage
functions. You can append text to an edit control with SetSel(-1, -1),
followed by ReplaceSel.

Joseph M. Newcomer [MVP]
email: newco...@xxxxxxxxxxxx
Web:http://www.flounder.com
MVP Tips:http://www.flounder.com/mvp_tips.htm- Hide quoted text -

- Show quoted text -

Guys,

Thanks a lot for your very helpful answers!

I don't need the ability of editing, changing fonts/color, word-wrap
and etc. However, I do need to allow user select a continous part of
the data that they can send them to the clipboard by pressing Ctrl-c.

I think I'm convinced that CListBox is the best choice.

-John
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: ES_MULTILINE flag crashes.
    ... All youv'e said is "my program fails, ... >I was using MFC and was creating an edit control dynamically. ... >class MyEdit: public CEdit ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: How to display a text file dynamically?
    ... have mfc souce code installed by default. ... Microsoft MVP in VC++ ... I urge avoiding the edit control entirely. ... the data that they can send them to the clipboard by pressing Ctrl-c. ...
    (microsoft.public.vc.mfc)
  • Re: Whod like to give me a sample support multilanguage?
    ... I used its predecessor (although I wasn't using any Pacific Rim languages, ... a samll dialog application with only one edit control. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: Color - Edit-Field
    ... Take a look at my "Validating edit control" on my MVP Tips site, ... And simple the whole edit-field, ... >row, or single word, the whole one. ...
    (microsoft.public.vc.mfc)