I suggest adding another constructor to your dialog class that takes an initial value, instantiate the dialog with that constructor and save the value, then override OnInitDialog and set the value there. For example:
// In AcqParamDialog.h
class CAcqParamDialog : public CDialog
{
public:
CAcqParamDialog(CWnd* pParent = NULL);
CAcqParamDialog(double initialValue, CWnd* pParent = NULL);
BOOL OnInitDialog();
// Dialog Data
//{{AFX_DATA(CAcqParamDialog)
enum { IDD = IDD_ACQPARAMDIALOG };
CNiNumEdit m_NumMasses;
//}}AFX_DATA
// ...
private:
double m_initialValue;
};
// In AcqParamDialog.cpp
CAcqParamDialog::CAcqParamDialog(double initialValue, CWnd* pParent /*=NULL*/)
: CDialog(CAcqParamDialog
::IDD, pParent), m_initialValue(initialValue)
{
}
BOOL CAcqParamDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_NumMasses.SetValue(m_initialValue);
return TRUE;
}
// ...
Then you can use this class like this:
double initialValue = (double)pDoc->PLocalAcqParams->PTheProgramSet->NumberOfMasses;
CAcqParamDialog dlg(initialValue, this);
// ...
This should let you show the dialog with the desired initial value without any problems. Please give this a try and see how it works out.
- Elton