Im having real problems getting MFC to communicate with itself. It seems that everything I define in the document is forgotten when the view file is run.
All I want a function to do is to draw a line based on XY co ordinates held in an array.
class CLine : public CObject
void RandomCoOrd(void);// set the genes
void DrawLine(CDC* pDC) const;//draw the line
//int SectionLength(int m_XYCoOrds);//returns length of section
//int ncrosses(int m_XYCoOrds);//gets the number of lines crossed
The Coordinates are random numbers that are stored in the XYCoOrds Array. Where [i] is X and [i] is Y. for each point. A line should then be drawn to the next point i.e. [i+1], [i+1]
There will be 10 such objects of this type with the names line1, line2 etc.
Whenever a new document is initialised I want the lines to be different so I have put the following into the doc.cpp file
// TODO: add reinitialization code here
The randomCoOrd function fills the XY array.
Now all I want to do is to draw the line. I have defined a menu item called line1 to show Line1. Add put the following code into it:
CThursDoc* pDoc = GetDocument();
CDC* pDC = GetDC ();
I thought that GetDocument was meant to let view see all the objects created in the DOC file. When I try and run this however it says that Lines1 is an undeclared identifier. PLEASE tell me where I am going wrong, I am literally tearing my hair out over this one.