Solved

child view 500 pts

Posted on 2004-10-14
7
199 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 44

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 177
mapBully challenge 6 114
firstChar challenge 13 110
Not needed 13 94
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now