attaching CScrollView to CStatic in CDialog
Posted on 1997-05-27
i am trying to attach CScrollView object to a CStatic object in a simple CDialog object in Visual C++ v5.0 through the MFC library at runtime.
if there's a better way to do this, i'm open to hearing it.
basically, what i need is an output dialog box that will handle potentially lots of lines of text and allow the user to scroll through it. the user can't edit the text. it's just there for output. so, i thought of the following set up.
class CResultsDlg : public CDialog
this is the dialog box that holds the text and the OK button to close. it's a simple modal dialog box with a horizontal scroll bar and a vertical scroll bar (do i need those or will the CScrollView handle this?) and a static text box.
class COutput : CScrollView
i used the MFC Class Wizard to create this class. however, if i declare it in CResultsDlg header, the compiler chokes and says it can't access the protected constructor. what good is the wizard if it won't let you construct the object you're trying to use? so, that's my first problem. that declaration looks like this:
and is in the Results.h header file. this is choked on 'cause the constructors of MFC classes are protected.
finally, there's the CStatic control which is simply a CWnd object that i'm trying to attach to the CScrollView object.
so, that's what i'm trying to do. does anyone know either a better way to go about doing this or have some code that does this or wants to give me some advise about going about this, i'd really appreciate it.