CFormView-like Modeless Dialog
Steve Mark -- steve@otms.com Wednesday, September 11, 1996 Environment: VC++ 4.2, Win95, WinNT Hi All, Is there any way to create a window with all of the attributes of CFormView WITHOUT having to create a CFormView. I really don't need the document class for this app, but I would like a scrollable, dialog-based MDI window. I've tried: 1. Modeless dialog: not MDI 2. CMDIChildWnd with the dialog resource created in it: background painting needs to be handled, no scrolling. Any other ideas? Or did I just not go far enough with #2? Steve
Dave_Rabbers@Quinton-Eng.CCMAIL.CompuServe.COM Thursday, September 12, 1996 [Mini-digest: 3 responses] I think CFormView gives you _exactly_ what you want. CFormView does not require a document. Just set the CDocument pointer to NULL, or if you are using CMultiDocTemplate, the document CRuntimeClass pointer to NULL. Voila, a CFormView without a document. Works great. I use it all the time. ______________________________ Reply Separator _________________________________ Subject: CFormView-like Modeless Dialog Author: INTERNET:steve@otms.com at CSERVE Date: 9/12/96 12:13 AM Sender: owner-mfc-l@majordomo.netcom.com Received: from majordomo.netcom.com (listless.netcom.com [206.217.29.105]) by hil-img-5.compuserve.com (8.6.10/5.950515) id XAA23075; Wed, 11 Sep 1996 23:51:01 -0400 Received: by majordomo.netcom.com (8.7.5/8.7.3/(NETCOM MLS v1.01)) id UAA17547; Wed, 11 Sep 1996 20:31:14 -0700 (PDT) Message-Id: <3.0b16.32.19960911070757.006f31d4@mail.ccnet.com> X-Sender: stevem@mail.ccnet.com X-Mailer: Windows Eudora Pro Version 3.0b16 (32) Date: Wed, 11 Sep 1996 09:29:34 -0700 To: mfc-l@netcom.com From: Steve MarkSubject: CFormView-like Modeless Dialog Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-mfc-l@majordomo.netcom.com Errors-To: owner-mfc-l@majordomo.netcom.com Precedence: bulk Reply-To: mfc-l@netcom.com Environment: VC++ 4.2, Win95, WinNT Hi All, Is there any way to create a window with all of the attributes of CFormView WITHOUT having to create a CFormView. I really don't need the document class for this app, but I would like a scrollable, dialog-based MDI window. I've tried: 1. Modeless dialog: not MDI 2. CMDIChildWnd with the dialog resource created in it: background painting needs to be handled, no scrolling. Any other ideas? Or did I just not go far enough with #2? Steve -----From: ganeshs@nationwide.com You could try CFormView as a child of CMDIChildWnd (giving it the ID of AFX_IDW_PANE_FIRST): CMyChildWnd::OnCreate(...) { CFormView* pDlgWnd = new CFormView; pDlgWnd->Create(...); // etc, etc... } Regards, / ___| / ___| __ _ _ __ ___ ___| | \___ \ | | _ / _` | '_ \ / _ \/ __| ___) | | |_| | (_| | | | | __/\__ \ | | |____(_) \____|\__,_|_| |_|\___||___/_| |_| -----From: Gordon Weakliem I know you said you don't want to create a CFormView, but you can create and use CView without a document. The framework will shoot out a warning that you're creating a view without a document, but it doesn't seem to harm anything. Mind you, I've discovered this from fooling around, I've never tried to write a serious app using this technique. Basically, what you'd do is: CChildFrame *pFrm = new CChildFrame; // CChildFrame is a CMDIChildWnd CCreateContext Cx; Cx.m_pNewViewClass = RUNTIME_CLASS(CMyView); Cx.m_pCurrentDoc = NULL; Cx.m_pNewDocTemplate = NULL; Cx.m_pLastView = NULL; Cx.m_pCurrentFrame = pFrm; // This may be unnecessary - I think it can safely be NULL pFrm->LoadFrame(IDR_NOTEMPTYPE, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, m_pMainWnd,&Cx); > 1. Modeless dialog: not MDI > 2. CMDIChildWnd with the dialog resource created in it: background painting > needs to be handled, no scrolling. Option #2 is a possibility, but there's so much code in CScrollView that would have to be duplicated that I'd pursue trying to use the view some more. After all, "You are not a machine, so stop repeating yourself" ;) -- Gordon Weakliem gweakl@metronet.com http://www.metronet.com/~gweakl
| Вернуться в корень Архива |