Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

child view 500 pts

Posted on 2004-10-14
7
Medium Priority
?
209 Views
Last Modified: 2013-11-20
Hi guys,
  i am creating a non-modal dialog box. I only want it to exist inside the view part of the application. Right now, i have created one, but I can move it anywhere on the screen, even over the menus. I only want to be able to move it inside the view, not anywhere else. Also, how would I maxamize that dialog box to cover the whole view? So basically, what i want is when the application is opened, the modeless dialog box is maxamized in the view area, and all my menus are still showing.

500 pts

paul
0
Comment
Question by:struggling_coder_3203
7 Comments
 
LVL 12

Expert Comment

by:OnegaZhang
ID: 12314641
Why not use CFormView?

set style of your dialog as WS_CHILD, set its parent to the view window

welcome to www.fruitfruit.com
0
 
LVL 45

Expert Comment

by:AndyAinscow
ID: 12316508
Further to OnegaZhang - new project, SDI based.  At the final stage you can change the CView to a CFormView based view.  This gives you a view that looks like a dialog and that you can create in the resource editor.  MFC will automatically size it to fit the client area.
0
 

Author Comment

by:struggling_coder_3203
ID: 12322293
ok, but how would i do it if i didn't want to use CFormView??
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 2

Expert Comment

by:Ruskialt
ID: 12324158
I was thinking MDI (multi document) application instead of SDI (single document). The "new project" wizard will do alot for you if you could consider rewriting the base of your application from scratch. It will have any number of open windows inside the main view, and maximize button on each one of them. Then use a CFormView as suggested by OnegaZang.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12329304
>ok, but how would i do it if i didn't want to use CFormView??

You can create a standard child window and add controls as members, then at OnCreate event create every control you have declared as member.
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 12329308
However I still agree with OnegaZhang that CFormView is the "cleanest" way to do what you want.
0
 
LVL 12

Accepted Solution

by:
OnegaZhang earned 1500 total points
ID: 12332361
if you insist to use a dialog, here is what I have tested
1. Set dialog resource style to Child
2. create a CDiloag based class , add windows message handler for WM_DESTROY

void CAboutDlg::OnDestroy()
{
      CDialog::OnDestroy();
      delete this;      
}
3. add a member to CxxxView
      class CAboutDlg* m_dlg;
4. add message handler for CxxxView
int CdlginviewView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
      if (CView::OnCreate(lpCreateStruct) == -1)
            return -1;

      m_dlg = new CAboutDlg();
      m_dlg->Create(CAboutDlg::IDD,this);
      return 0;
}

void CdlginviewView::OnSize(UINT nType, int cx, int cy)
{
      CView::OnSize(nType, cx, cy);
      if(cx>1 && cy>1 && m_dlg && !m_dlg->IsWindowVisible())
            m_dlg->ShowWindow(SW_SHOWMAXIMIZED);
}

welcome to www.fruitfruit.com
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question