Solved

child view 500 pts

Posted on 2004-10-14
7
201 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 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