Use VC for MapX Second Development II ------ Using Mapx's cornerstone Writer: bluedy er-huang@163.com
Before you start, I assume that the reader is familiar with VC programming (understand some), and the system is installed in VC 5.0 (or above, suggests VC 6.0) and MAPX4.0 (or above). If you haven't completed the above steps, getReader (). STOP (); please satisfy the previous IF statement.
Ok, let us start our Mapx journey!
For C programs, each MAPX object (Objects) is implemented in Mapx.h and Mapx.cpp, with a class with a class, the name of the class, and the name of the MAPX object is defined in CMAPX. For example, the DataSet object is implemented with class CMAPXDataSet. This is consistent with the definition of the C class. So what about the property (Properties)? Mapx's properties are implemented using the member functions of the class. For example, the name of the DataSet object (Name) is implemented with the name () function, but Name () has two ways of use, namely Get and SET. Such as: cstring getname (); // Get object name void setName (LPCTSTR); // Setting the object name, do you think Get and SET are a bit familiar? Then look at the functions below: getButTominfo (); getButTomtext (); setButTominfo (); setButTomText (); above the function of the MFC standard, and common functions. So, you learn MapX development, you can imagine that objects and properties in MapX are class and member functions inside the MFC. that is it.
Let us now create our MapX cornerstone. Step 1: Create a single document program MapxSample with the VC Program Wizard. Step 2: Project> Add to Project> FILES, select Mapx.cpp and Mapx.h. Step 3: Define a CMAPX object. Class CMAPXSAMPLEVIEW: PUBLIC CVIEW {... protected: cmapx m_ctrlmapx; ......} Step 4: Declare a constant. View> Resource Symbols> New> Name is IDC_MAP. Step 5: Create a WM_SIZE and WM_CREATE for CMAPXSampleView in class wizard: void cmapxsampleview :: oncreate (uint ntype, int cx, int CY) {m_ctrlmapx.create (null, ws_visible, crect (0,0,100,100), THIS , IDC_map);} void cmapxsampleview :: ONSIZE (uint ntype, int cx, int CY) {
CView :: OnSize (NTYPE, CX, CY); M_CTRLMAPX.MOVEWINDOW (0, 0, CX, CY, TRUE);
Step 6: Create a WM_SETFOCUS processing message for CMAPXSAMPLEVIEW in class wizard to ensure focus when the window is active. Void cmapxsampleview :: OnsetFocus (cwnd * PoldWnd) {cview :: OnsetFocus (PoldWnd); m_ctrlmapx.setfocus ();} is then compiled. see it? This is the most basic MAPX program, I call it "Mapx's cornerstone", because the future procedures are "sewing supplements" based on this program.