Re: Constructor of dialog box...
On 1 oct, 16:49, ".rhavin grobert" <cl...@yahoo.de> wrote:
On 1 Okt., 16:31, Mikel <mikel.l...@gmail.com> wrote:
On 1 oct, 16:20, ".rhavin grobert" <cl...@yahoo.de> wrote:
On 1 Okt., 15:52, RAB <rabmisso...@yahoo.com> wrote:
Is this the best way to set up this situation?
possibly better to give const ref to CString or simple LPCTSTR as
argument, eg:
MyDialog::MyDialog(CWnd* pParent /*=NULL*/, CString const& PassStri=
ng)
: CDialog(MyDialog::IDD, pParent)
or
MyDialog::MyDialog(CWnd* pParent /*=NULL*/, LPCTSTR szString)
: CDialog(MyDialog::IDD, pParent)
You can't have a default value for the first parameter and not for the
second, can you?
the first has no default value, '=NULL' is commented out.- Ocultar text=
o de la cita -
- Mostrar texto de la cita -
That's the definition, not the declaration. Usually, such comments
appear in the definition to remind that the parameter has a default
value. In fact, if you derive a class from CDialog, using the IDE,
that's what you get.
For example, I've just created a CDialog derived class and I get the
following code:
//////// MyDialog.h
#pragma once
// Cuadro de di=E1logo de MyDialog
class MyDialog : public CDialog
{
DECLARE_DYNAMIC(MyDialog)
public:
MyDialog(CWnd* pParent = NULL); // Constructor est=E1ndar
virtual ~MyDialog();
// Datos del cuadro de di=E1logo
enum { IDD = IDD_MYDIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // Compatibilidad
con DDX/DDV
DECLARE_MESSAGE_MAP()
};
/////// End of MyDialog.h
// MyDialog.cpp: archivo de implementaci=F3n
//
#include "stdafx.h"
#include "XXXXXXXXX.h"
#include "MyDialog.h"
// Cuadro de di=E1logo de MyDialog
IMPLEMENT_DYNAMIC(MyDialog, CDialog)
MyDialog::MyDialog(CWnd* pParent /*=NULL*/)
: CDialog(MyDialog::IDD, pParent)
{
}
MyDialog::~MyDialog()
{
}
void MyDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(MyDialog, CDialog)
END_MESSAGE_MAP()
// Controladores de mensajes de MyDialog
Note how in the .h you get the default parameter declaration and in
the .cpp you get the /*=NULL*/ comment in the constructor.
That's why I talked about default parameters, because I thought, and
still think, unless the OP says so, that there are default parameters
in that constructor.