Click to See Complete Forum and Search --> : CFormView


Santhosh Cheeran
April 21st, 1999, 03:35 PM
Why should I use a CFormView rather than a dialog box, what are the additional fetures coming with it

Volkan
April 21st, 1999, 04:02 PM
If I'm thinking of the same thing you are, you get a menu, toolbar and status bar for free.

You also get the printing features and help stubs.

Santhosh Cheeran
April 21st, 1999, 04:07 PM
What about the serailization,will I have a chance with the serialization also

Volkan
April 21st, 1999, 06:50 PM
Yes, if it's an SDI or MDI app, you get serialization stubs too.
Using the CFormView gives you the option of adding controls as you would with a dialog. I don't think you lose anything by going with a CFormView.

I have a CFormView based application here at work (that I'm writing).

April 22nd, 1999, 05:09 AM
> You also get the printing features

I just ran into a particular "mis-feature" of CFormView which puts this statement into some doubt. I have a multi-view app where I used CFormView for a number of my views (because each contains only a single window-size ActiveX control, and ClassWiz makes ActiveX event mapping easy within form views). When I started hooking up printing for the first CFormView-based view I got this [annoying!] debug output:

"Warning: CFormView does not support printing.\n"

which you can find in the MFC surce code VIEWFORM.CPP, in OnDraw() :

// do nothing - dialog controls will paint themselves,
// and Windows dialog controls do not support printing
#ifdef _DEBUG
if (pDC->IsPrinting())
TRACE0("Warning: CFormView does not support printing.\n");
#endif


;-(

Which, of course, begs the question - is it really that rare to want to print form views? ( No, the ActiveX controls in my views aren't text-based or database-based ).