From: Heck on
On Mon, 10 May 2010 06:49:03 -0700 (PDT), "ScottMcP [MVP]"
<scottmcp(a)mvps.org> wrote:
>
>The MFC CView class is a blank window, intended for situations where
>you want to generate the displayed image yourself. It displays
>nothing by itself.
>
>You have to add drawing code in the OnDraw function of your class
>derived from CView (or CScrollView). Generally, your OnDraw code will
>call GetDocument() and use the returned pointer to access whatever
>data you need to do the drawing.
>
>The MFC SCRIBBLE tutorial is an example of this doc/view
>relationship. Going through this tutorial might help you. There is a
>linked list of line segments stored in the CDocument, and the view
>OnDraw draws it.

I see the functions for drawing points, lines and arcs, but I don't
understand what the general, basic text output function is. I've
managed to write strings to a CView, but the output wasn't properly
formatted and I couldn't get it into the form I wanted. Is there
something like a printf() for CViews?

I tried using a CListView, too, but so far, unsuccessfully. And, to
top it off, I couldn't get the two scrollbars to appear, though I
played around with ShowScrollBar(SB_BOTH) till I was hopeless.

I want to make a status/debug window in my SDI app, in which I'll
output various strings in various colors, to describe the state of my
program's other operations. I want a window, not a dialog box, with
resizability, scrollbars and to be able to copy its contents to the
clipboard. So, it has the features of CEdit, CScrollView and maybe
CListView. I read multiple inheritance is problematic in MFC, so I've
avoided that. How should I concoct the class out of which I'll make
this view?

Thanks very much.
(multiple-posted in microsoft.public.win32.programmer.ui)
From: ScottMcP [MVP] on
On May 11, 12:27 pm, Heck
<heckja...(a)ordertostymieharvestersverizon.net> wrote:
> On Mon, 10 May 2010 06:49:03 -0700 (PDT), "ScottMcP [MVP]"
>
> <scott...(a)mvps.org> wrote:
>
> >The MFC CView class is a blank window, intended for situations where
> >you want to generate the displayed image yourself.  It displays
> >nothing by itself.
>
> >You have to add drawing code in the OnDraw function of your class
> >derived from CView (or CScrollView).  Generally, your OnDraw code will
> >call GetDocument() and use the returned pointer to access whatever
> >data you need to do the drawing.
>
> >The MFC SCRIBBLE tutorial is an example of this doc/view
> >relationship.  Going through this tutorial might help you.  There is a
> >linked list of line segments stored in the CDocument, and the view
> >OnDraw draws it.
>
> I see the functions for drawing points, lines and arcs, but I don't
> understand what the general, basic text output function is.  I've
> managed to write strings to a CView, but the output wasn't properly
> formatted and I couldn't get it into the form I wanted.  Is there
> something like a printf() for CViews?
>
> I tried using a CListView, too, but so far, unsuccessfully.  And, to
> top it off, I couldn't get the two scrollbars to appear, though I
> played around with ShowScrollBar(SB_BOTH) till I was hopeless.
>
> I want to make a status/debug window in my SDI app, in which I'll
> output various strings in various colors, to describe the state of my
> program's other operations.  I want a window, not a dialog box, with
> resizability, scrollbars and to be able to copy its contents to the
> clipboard.  So, it has the features of CEdit, CScrollView and maybe
> CListView.  I read multiple inheritance is problematic in MFC, so I've
> avoided that.  How should I concoct the class out of which I'll make
> this view?
>
> Thanks very much.
> (multiple-posted in microsoft.public.win32.programmer.ui)

CEditView (derived from CView) consists of a view that is filled with
a CEdit control. The CEdit control implements text painting and
scrolling for you. But it does not do multiple colors.

CRichEditView is similar, but it does permit multiple colors. One of
the sample programs that come with MFC is a complete Notepad-like
editor based on these view classes.

You might also be interested in Joe Newcomer's status/debug window,
based on a CListBox, which can be found at http://www.flounder.com/
From: Heck on
On Tue, 11 May 2010 10:20:24 -0700 (PDT), "ScottMcP [MVP]"
<scottmcp(a)mvps.org> wrote:

>On May 11, 12:27�pm, Heck
><heckja...(a)ordertostymieharvestersverizon.net> wrote:
>> On Mon, 10 May 2010 06:49:03 -0700 (PDT), "ScottMcP [MVP]"

snip

>CEditView (derived from CView) consists of a view that is filled with
>a CEdit control. The CEdit control implements text painting and
>scrolling for you. But it does not do multiple colors.
>
>CRichEditView is similar, but it does permit multiple colors. One of
>the sample programs that come with MFC is a complete Notepad-like
>editor based on these view classes.
>
>You might also be interested in Joe Newcomer's status/debug window,
>based on a CListBox, which can be found at http://www.flounder.com/

Thanks. I see members of both CEditView and CRichEditView provide the
relatively high-level output I was missing. I'll use the associated
apps, superpad and wordpad, to see how to use them. One additional
question, does CRichEditView require using CRichEditCtrl? It seems
it's necessary only when handling OLE objects.

Thanks for the reference to Newcomb's work.
From: ScottMcP [MVP] on
On May 11, 4:26 pm, Heck
<heckja...(a)ordertostymieharvestersverizon.net> wrote:
> One additional
> question, does CRichEditView require using CRichEditCtrl?  It seems
> it's necessary only when handling OLE objects.

CRichEditView is actually a CRichEditCtrl plus a little code to make
it view-like. You have to call CRichEditView::GetRichEditCtrl to get
a reference to the underlying control. Then you can use this reference
to access all the CRichEditCtrl's methods.

OLE is just one feature of the control, as is multiple colors.

From: Heck on
On Tue, 11 May 2010 17:22:25 -0700 (PDT), "ScottMcP [MVP]"
<scottmcp(a)mvps.org> wrote:

>On May 11, 4:26�pm, Heck
><heckja...(a)ordertostymieharvestersverizon.net> wrote:
>> One additional
>> question, does CRichEditView require using CRichEditCtrl? �It seems
>> it's necessary only when handling OLE objects.
>
>CRichEditView is actually a CRichEditCtrl plus a little code to make
>it view-like. You have to call CRichEditView::GetRichEditCtrl to get
>a reference to the underlying control. Then you can use this reference
>to access all the CRichEditCtrl's methods.
>
>OLE is just one feature of the control, as is multiple colors.

What makes it view-like? That's a broad question. What are the
essential characteristics of a view, both abstractly and in
implementation?