Dialog box pop-ups - SDI vs. MDI apps 
Author Message
 Dialog box pop-ups - SDI vs. MDI apps

I have a multiple document interface application where one child window
comes up.  I'm trying to implement a simple application where when I
left click in the child window a dialog box pops up.  I'm following a
mix of two examples.  One on dialog boxes and one on MDI's.  I create
the dialog resource and class and follow an example for a modeless dialog
box.  I create a function for the left mouse click and during debug the
program gets there but no dialog box pops-up.
The project is caled Multi, and the dialog class is CSSDialog.  Below are
some code fragments.
------------------------------------------------------------
SSDialog.h
----------
class CSSDialog : public CDialog
{
private:
 CView* m_pView;
public:
 CSSDialog(CView* pView);
 BOOL Create();
// Construction
public:
 CSSDialog(CWnd* pParent = NULL);   // standard constructor
// Dialog Data
 //{{AFX_DATA(CSSDialog)
 enum { IDD = IDD_SS };
  // NOTE: the ClassWizard will add data members here
 //}}AFX_DATA

// Overrides
 // ClassWizard generated virtual function overrides
 //{{AFX_VIRTUAL(CSSDialog)
 protected:
 virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
 //}}AFX_VIRTUAL
// Implementation
protected:
 // Generated message map functions
 //{{AFX_MSG(CSSDialog)
  // NOTE: the ClassWizard will add member functions here
 //}}AFX_MSG
 DECLARE_MESSAGE_MAP()

Quote:
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations
immediately before the previous line.
#endif //
!defined(AFX_SSDIALOG_H__4E95115B_11A6_11D2_8080_00C04F9E3A5D__INCLUDED_)

------------------------------------------------------------
SSDialog.cpp
------------
CSSDialog::CSSDialog(CView* pView) {
 m_pView = pView;

Quote:
}

CSSDialog::CSSDialog(CWnd* pParent /*=NULL*/)
 : CDialog(CSSDialog::IDD, pParent)
{
 m_pView = NULL;
 //{{AFX_DATA_INIT(CSSDialog)
  // NOTE: the ClassWizard will add member initialization here
 //}}AFX_DATA_INIT
Quote:
}

BOOL CSSDialog::Create() {
 return CDialog::Create(CSSDialog::IDD);
Quote:
}

------------------------------------------------------------
MultiView.h
-----------
class CSSDialog;
class CMultiView : public CView
{
private:
 CSSDialog* m_pDlg;
protected: // create from serialization only
 CMultiView();
 DECLARE_DYNCREATE(CMultiView)
// Attributes
public:
 CMultiDoc* GetDocument();
------------------------------------------------------------
MultiView.cpp
-------------
CMultiView::CMultiView()
{
 // TODO: add construction code here
 m_pDlg = new CSSDialog(this);
Quote:
}

CMultiView::~CMultiView()
{
 delete m_pDlg;
Quote:
}

void CMultiView::OnLButtonDown(UINT nFlags, CPoint point)
{
 // TODO: Add your message handler code here and/or call default

 if (m_pDlg->GetSafeHwnd() == 0) {
  m_pDlg->Create();
    }
 //CView::OnLButtonDown(nFlags, point);

Quote:
}

------------------------------------------------------------
My goal is to have a project window where I can have multiple dialog
boxes pop up from various pull down menu items.  These dialog boxes
will be modeless so I can move between them and enter values/click
buttons, etc.  Am I correct in assuming that I need an MDI for this????
Thank you.
Please also respond to



Mon, 18 Dec 2000 03:00:00 GMT  
 Dialog box pop-ups - SDI vs. MDI apps

Quote:

>I have a multiple document interface application where one child window
>comes up.  I'm trying to implement a simple application where when I
>left click in the child window a dialog box pops up.  I'm following a
>mix of two examples.  One on dialog boxes and one on MDI's.  I create
>the dialog resource and class and follow an example for a modeless dialog
>box.  I create a function for the left mouse click and during debug the
>program gets there but no dialog box pops-up.

Have you checked "visible" in the resource editor? It may just hide...

Quote:
>My goal is to have a project window where I can have multiple dialog
>boxes pop up from various pull down menu items.  These dialog boxes
>will be modeless so I can move between them and enter values/click
>buttons, etc.  Am I correct in assuming that I need an MDI for this????

No, you don't need a MDI for this. The Dialogs are traditionally independent
of the MainWindow (toplevel windows). You only need a MDI when you have
multiple documents, or multiple views in frame windows that you want to be
contained in the MainFrame.

cU
--

   http://djuga.home.ml.org
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Retriever 2.0 is out: http://retriever.home.ml.org

Shareware image viewer, thumbnailer & database
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Mon, 18 Dec 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Dialog box pop-up - SDI vs. MDI apps

2. Help pop-ups in MFC App

3. SDI vs. MDI apps

4. Modeless dialog boxes in MDI app

5. How to remove certain doc types from the file|new dialog box in MDI apps

6. MDI app w/ modal-less dialog box (inter-view communication)

7. PBM: Message box not displayed after main dialog box is closed in MFC dialog-based app

8. pop ups in webbrowser control

9. How do I interfere with system pop-ups

10. Command Processing in Pop-Ups

11. MDI vs SDI Applications

12. MDI vs SDI

 

 
Powered by phpBB® Forum Software