Un-cooperative Popup

JoeBo
10-20-2007, 02:43 AM
Hi

Firstly my apologies, this is the second posting on this issue, I need to get to the bottom of this. I am using visual studio 2005 (vb.net) to control a mappoint 2004 activex control. When the user clicks a position the map a pushpin is added and the latitude/longitude is placed onto a record. This works really well until the user clicks on a location where there is underlying information, this causes mappoint to pop a dialog with the location information. The suggested fix is to cancel the pop up on the beforedouble click event on the active x control I have attempted to do this with no success. I have included the opening lines of the code below; can anyone give me the definitive answer to this problem?

Any help appreciated
Joe


Code:

Private Sub AxMappointControl1_BeforeDblClick(ByVal sender As System.Object, ByVal e As AxMapPoint._IMappointCtrlEvents_BeforeDblClickEven t) Handles AxMappointControl1.BeforeDblClick

Try
e.cancel = True ‘should I be sending cancel some other way
Dim objMap As MapPoint.Map
objMap = Me.AxMappointControl1.ActiveMap
Dim objDataSet As MapPoint.DataSet
Dim txt1, txt2, txt0, txt4 As String
Dim Ilat, Ilong As Double
Dim objResult As Object
Dim objResults As MapPoint.FindResults

objResults = objMap.ObjectsFromPoint(e.x, e.y)

JoeBo
10-21-2007, 08:04 AM
Hi

Doesn’t look as though I am getting anywhere with this, I will try and elaborate.
The information I have been able to find on the mappoint support sites suggest that to cancel the popup menu when the active map is double clicked you should use cancle in the before double click event, in looks as though the way the event is called has altered in vb.net from:

Private Sub AxMappointControl1_BeforeDblClick(ByVal Button As Long, ByVal Shift As Long, ByVal X As Long, ByVal Y As Long, Cancel As Boolean)

To:

Private Sub AxMappointControl1_BeforeDblClick(ByVal sender As System.Object, ByVal e As AxMapPoint._IMappointCtrlEvents_BeforeDblClickEven t) Handles AxMappointControl1.BeforeDblClick

In the mappoint section on msdn it suggests that you can cancel the event by setting cancel = true. In the newer version the equivalent (as I read it) would be to set e.cancel = true. But this doe’s not cancel the event????

Regards,
Joe

Wilfried
10-23-2007, 08:56 AM
Hi,

you are correct about e.cancel = true; But I think you want to use the BeforeClick instead fo the BeforeDblClick event.

JoeBo
10-23-2007, 09:06 AM
Hi wilfred

Thanks for your post, you are correct, I added the cancel event to the before click event and this corrected the problem, it also created another, I want my user to be able to scroll on the map but these controls are canceled at he same time as the popup! Am I correct in assuming that their is no work around to this apart from providing the controls elsewhere.

Regards,
Joe

Wilfried
10-23-2007, 09:29 AM
Hi,

you mean by scroll the 'pan' map when the white arrows are visible if mouse pointer is near the edges ?

if yes many things you can do I think, I should solve it by putting 4 transparent panels on the map and handle the panning of the map from there. You can give a custom cursor to each panel, also for the directions NE, NW, etc you can change cursor.

If you want the user to be not able to do any control on the map (unless the pan) you can put a large transparent panel on the map. This will then intercept not only mouse clicks but also keyboard. Then you have it all in control.

JoeBo
10-23-2007, 09:36 AM
Hi Wilfred,

That sounds exactly what I need to do, one question how do I get the code block to pan the map to repeat whilst the mouse is over the panel?

For example if I use this:

Dim objMap As MapPoint.Map
objMap = Me.AxMappointControl1.ActiveMap
objMap.Pan(MapPoint.GeoPanCmd.geoNorthEast)

I get one map movement, how do I get the code to run continueslly.

Regards,
Joe

Wilfried
10-23-2007, 10:07 AM
Hi,

I use a timer for this. use MouseDown and MouseUp events to enable / disable the timer. Set the interval to 1 millisecond (this will interval exactly one timeslice which is 10 ms on workstation and 20 ms on server OS. Take a panFactor of 0.07 to start. This will be a good start.

instead of a timer you can also use a custom message handler, but I think a timer is wise to use in this case.

JoeBo
10-23-2007, 10:17 AM
Hi Wilfred,

Thanks for the support, I will try out the timer suggestion and let you know who it goe’s.

Regards,
Joe

 
Web mp2kmag.com
mapforums.com