Solved

Dialog a no show?

Posted on 2000-02-13
8
231 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
ID: 2517100
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
ID: 2517114
Check your MessageMap
0
 
LVL 2

Expert Comment

by:waseemanis
ID: 2517529
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
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 3

Expert Comment

by:V_Bapat
ID: 2517765
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
 
LVL 2

Accepted Solution

by:
bbousquet earned 50 total points
ID: 2517811
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
ID: 2518111
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
ID: 2524870
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
ID: 2524891
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

816 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

12 Experts available now in Live!

Get 1:1 Help Now