Solved

Dialog a no show?

Posted on 2000-02-13
8
210 Views
Last Modified: 2013-11-20
I've created a dialog resource and let the class wizard create a shell class for me. i've added some callbacks and accessor functions to it and new when I call DoMModal() the dialog doesnt show up on the screen, any ideas why? I am creating the dialog in my OnNewDocument() call back.
0
Comment
Question by:cpa802
8 Comments
 

Author Comment

by:cpa802
Comment Utility
Sorry :) Source might help :)


class CMUDDialog : public CDialog
{
// Construction
public:
      CMUDDialog(CWnd* pParent = NULL);   // standard constructor
      char *GetName();
      char *GetAddress();
      int GetPort();
      virtual BOOL OnInitDialog();

// Dialog Data
      //{{AFX_DATA(CMUDDialog)
            // NOTE: the ClassWizard will add data members here
      //}}AFX_DATA


// Overrides
      // ClassWizard generated virtual function overrides
      //{{AFX_VIRTUAL(CMUDDialog)
      protected:
      virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
      //}}AFX_VIRTUAL

// Implementation
protected:

      // Generated message map functions
      //{{AFX_MSG(CMUDDialog)
      afx_msg void OnOk();
      afx_msg void OnCancel();
      afx_msg void OnRename();
      afx_msg void OnDelete();
      afx_msg void OnAdd();
      //}}AFX_MSG
      DECLARE_MESSAGE_MAP()
};


CMUDDialog::CMUDDialog(CWnd* pParent /*=NULL*/)
      : CDialog(IDD_CONNECT, pParent)
{
      //{{AFX_DATA_INIT(CMUDDialog)
            // NOTE: the ClassWizard will add member initialization here
      //}}AFX_DATA_INIT
}


void CMUDDialog::DoDataExchange(CDataExchange* pDX)
{
      CDialog::DoDataExchange(pDX);
      //{{AFX_DATA_MAP(CMUDDialog)
            // NOTE: the ClassWizard will add DDX and DDV calls here
      //}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMUDDialog, CDialog)
      //{{AFX_MSG_MAP(CMUDDialog)
      ON_BN_CLICKED(IDC_BOK, OnOk)
      ON_BN_CLICKED(IDC_BRENAME, OnRename)
      ON_BN_CLICKED(IDC_BDELETE, OnDelete)
      ON_BN_CLICKED(IDC_BCANCEL, OnCancel)
      ON_BN_CLICKED(IDC_BADD, OnAdd)
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMUDDialog message handlers

void CMUDDialog::OnOk()
{
      // TODO: Add your control notification handler code here
      EndDialog(IDOK);
}

void CMUDDialog::OnCancel()
{
      // TODO: Add your control notification handler code here
      EndDialog(IDCANCEL);
}

void CMUDDialog::OnRename()
{
      // TODO: Add your control notification handler code here
      
}

void CMUDDialog::OnDelete()
{
      CListCtrl *list;

      list=(CListCtrl*)GetDlgItem(IDC_WORLD_LIST);
}

void CMUDDialog::OnAdd()
{
      // TODO: Add your control notification handler code here
      
}

char *CMUDDialog::GetName(){
   return NULL;
}

char *CMUDDialog::GetAddress(){
   return NULL;
}


int CMUDDialog::GetPort(){
   return 0;
}

BOOL CMUDDialog::OnInitDialog(){
      //Initialize list control
      return TRUE;
}
0
 
LVL 1

Expert Comment

by:aperdon
Comment Utility
Check your MessageMap
0
 
LVL 2

Expert Comment

by:waseemanis
Comment Utility
Check your OnInitDialog func.

I think you'll need to call the CDialog::OnInitDialog, the first thing in the function.


BOOL CMUDDialog::OnInitDialog()
{
// this is were i think you are missing
CDialog::OnInitDialog();
//Initialize list control
return TRUE;
}

Luck,
Waseem.
0
 
LVL 3

Expert Comment

by:V_Bapat
Comment Utility
Try what Waseem suggested. In case you are calling CDialog::OnInitDialog(), post the OnInitDialog() and constructor(if there is something) code. It would help us analyze the problem better.

Vicky
0
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.

 
LVL 2

Accepted Solution

by:
bbousquet earned 50 total points
Comment Utility
Is your dialog marked as 'Visible' in the resource editor?

[This sounds pretty dumb, but it's happened to the best of us!]
0
 
LVL 1

Expert Comment

by:oarguimb
Comment Utility
I'm agreee with 'waseemanis'

The call to base class CDialog::OnInitDialog()  is missing !!
So it didn't do anything.
0
 

Author Comment

by:cpa802
Comment Utility
The call to CDialog::OnInitDialog() didnt help, actually I couldnt even get the dialog to appear before I overode the method, I only added it in case I had to.
Also the dialog is marked as visible.
0
 

Author Comment

by:cpa802
Comment Utility
I loaded the .rc file in to a text editor and found that the dialog didnt have the visible attribute on it and was actually set as disabled. I reloaded the .rc file and it magically decided to tell me that it was disabled and I changed the proper styles.
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
if loop error 4 76
repeateFront java challenge 31 86
maxBlock challenge 30 99
scoreUp challenge 14 47
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

771 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

10 Experts available now in Live!

Get 1:1 Help Now