?
Solved

child view 500 pts

Posted on 2004-10-14
7
Medium Priority
?
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

752 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