Greetings.
I am writing a programme that uses dialog 'screens' to gather data. It uses list boxes and edit boxes which need setting with default values, or after use the user's entered value/script. requires a number of list box.
To clarify the code I wish to put this initiation and retreval (DDV & DDX) into functions, but I cannot seem to define them correctly.
I have written a simple test routine and copied the relevant parts and comments below. -
I am using "Microsoft Visual Studio 2010 Proffesional"
Any assistance would be much appreciated, have spent two days on and off wrestling with this. 😐️
// from "CTester_V10View::CTester_V10View()"
//
s_ReturnString = _T("source message");
// from Dialog .h file
//
CString s_DialogString;
// *****************************************************************
void CTester_V10View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
TestDialog Tester; // Declare instance of dialog
SetUp(Tester); // call routine to set up Dialog
if(Tester.DoModal() == IDOK) // Return from dialog box
s_ReturnString = Tester.s_DialogString; // get returned
// string from dialog edit box
CView::OnLButtonDown(nFlags, point);
}
// *****************************************************************
// Declaration of this function is the problem !
//
int CTester_V10View::SetUp(const TestDialog& Fred) // test function sets up initial string in edit box
{
Fred.s_DialogString = s_ReturnString; // s_ReturnString set to initial test
// string in "CTester_V10View()"
return 0;
}
// *****************************************************************
// Declarations tried and failed
//
// Declarations giving error messages of
// "incompattible with declaration in .h file" against "SetyUp"
//
int CTester_V10View::SetUp(const TestDialog &Fred)
int CTester_V10View::SetUp(const TestDialog& Fred)
// Declaration gives 'red error' on
// * - Explicit type is missing
// "Fred" Expected a ')'
//
int CTester_V10View::SetUp(const *TestDialog Fred)
// Declaration gives following 'red error'
// No operator '=' matches these operands i.e. in body of function
// for "Fred.s_DialogString = s_ReturnString;"
//
int CTester_V10View::SetUp(const class TestDialog Fred)
int CTester_V10View::SetUp(const class TestDialog& Fred)
// On build following error message.
// error C2678: binary '=' : no operator found which takes a left-hand operand of
// type 'const CString' (or there is no acceptable conversion)
//
int CTester_V10View::SetUp(const class TestDialog &Fred)