Solved

child view 500 pts

Posted on 2004-10-14
7
198 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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 31
Windows Drag & Drop Location 2 85
Whole sheet autoscrub still needed 19 44
matchUp  challenge 9 72
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: 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…
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 video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

9 Experts available now in Live!

Get 1:1 Help Now