IfProgramSimilarly, the on_wm_lbuttondown () macro does not work. The program will never be executed in your onlbuttondown (uint nflags, cpoint point) function.
The method is as follows:
It mainly uses a set of message-related macros defined by MapX.
We assume that the name of the attempt class is:
Cdemoview
Here we want to add a message processing function that responds to mouse movement.
1. First, add the declare_eventsink_map () macro under declare_message_map () of the demoview. h file.
2. Add the following in the demoview. cpp file header:Code:
# Define idr_map 100
3. Add the following code to the demoview. cpp file:
1 Begin_eventsink_map (cdemoview, cview)
2 On_event (cdemoview, idc_map, dispid_mousemove, onmousemoveinmap, vts_i2 vts_i2 vts_xpos_pixels vts_ypos_pixels)
3 End_eventsink_map ()
4. Add the following code in the demoview. h file:Bool onmousemoveinmap (ShortButton,ShortShift, ole_xpos_pixels X, ole_ypos_pixels y );
5. Add the following code to the demoview. cpp file:
Bool cmapgeneratorview: onmousemoveinmap ( Short Button, Short Shift, ole_xpos_pixels X, ole_ypos_pixels y)
{
Float Screenx = ( Float ) X;
Float Screeny = ( Float ) Y;
Double MapX;
Double Mapy;
M_ctrlmapx.convertcoord ( & Screenx, & Screeny, & MapX, & Mapy, miscreentomap );
Cstring currentpos;
Currentpos. Format ( " Longitude: % F, latitude: % F " , MapX, mapy );
Return True;
}
In general, you can add the methods for responding to related events such as mouse clicks, and so on.