Newbie question - displaying text in a view 
Author Message
 Newbie question - displaying text in a view

I'm really new at this MFC stuff - so here's my problem:

I'm returning a formatted string (CString) through a Windows Socket to a
variable.

I want to display that string _with_ its formatting (CR - LF, etc.) in
the CView of my app. AND I want to display subsequent strings vertically
downward in a scrollable view.

What CView, CEditView, and CListBox do - is display a vertical black bar
for each control character it encounters using SetWindowText.

CRichEditView displays the multiline output correctly, but always
overwrites previous text (it seems to always start displaying at 0,0).

CScrollView doesn't seem to possess a SetWindowText method.

This sure seems like something that should be quite simple, but over 2
weeks of searching the MSDN library and online hasn't yielded this
nugget.

How do I get multiline text to display properly AND downward?

Thanks,

Gary Hasman



Fri, 25 Jul 2003 06:18:01 GMT  
 Newbie question - displaying text in a view

Quote:

> I'm really new at this MFC stuff - so here's my problem:

> I'm returning a formatted string (CString) through a Windows Socket to a
> variable.

> I want to display that string _with_ its formatting (CR - LF, etc.) in
> the CView of my app. AND I want to display subsequent strings vertically
> downward in a scrollable view.

> What CView, CEditView, and CListBox do - is display a vertical black bar
> for each control character it encounters using SetWindowText.

> CRichEditView displays the multiline output correctly, but always
> overwrites previous text (it seems to always start displaying at 0,0).

> CScrollView doesn't seem to possess a SetWindowText method.

> This sure seems like something that should be quite simple, but over 2
> weeks of searching the MSDN library and online hasn't yielded this
> nugget.

> How do I get multiline text to display properly AND downward?

> Thanks,

> Gary Hasman

SetWindowText replaces all the existing text with new text.  It sounds like you
want to append to the existing text.  Get a pointer to the control (w/
GetRichEditCtrl) and call the control's SetSel(-1,-1) to move its insertion
point to the end of the existing text.  Then call ReplaceSel to append new
text.  Use "\r\n" to force line breaks.

--
Scott McPhillips [VC++ MVP]



Fri, 25 Jul 2003 07:39:31 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. newbie simple question on text display

2. Newbie Question - displaying text

3. newbie question on displaying text from a file

4. comboBox.Text question - How do i display text?

5. Newbie question...replacing text in a text file.

6. Newbie : Display text in bold

7. Newbie : Display text in bold

8. Newbie: document to view (i.e. displaying data)

9. Need to display a large amount of text in a view

10. new view in MDI-app that displays plain text

11. Newbie Question: Displaying Sprites

12. Newbie Question: Displaying picture in a bound control

 

 
Powered by phpBB® Forum Software