Issues with lates mapcontrol (5.2)

Hi @pmeems I have been meaning to post the issues I have been facing with the latest version of the ocx. However, in my computer, I have an app that is using the older version.

To test the new version, I need both versions of the ocx installed in my computer and I am not sure how to do this although right now I have both versions already in my computer. Version 4.9.6 is installed in c:\dev and the latest version in c:\dev_5.2 .

However, there is one thing I am sure that is not working with the newer version.

If mapcursor is set to tkCursorMode.cmSelection , the _axMap.SelectBoxFinal event is not captured.

I also downloaded MapWindow and after opening a shapefile layer and using the select by polygon tool, MapWindow shuts down. I think this is related to the issue above.

I would like to test the control much more comprehensively but my available time is on weekends only.

My work environment is Windows10 1909 with VisualStudio 2019 Community Edition 16.4.6

I will have a look at this…

Hello @RaffyM

Regarding the SelectBoxFinal event, this is working for me. Presuming, of course, that you’ve added the event handler, the only other requirement is to set AxMap1.SendSelectBoxFinal = True.

I am receiving the event for Zoom boxes as well as the Selection boxes. If you’re not getting these, then we’ll have to dig deeper. Perhaps you could post some of your code.

Regards,
Jerry.

Hi @jerryfaust

Here is a simple project I used to test the latest version (5.2.3). I also tested this code on version 4.9.6

    public Form1()
    {
        InitializeComponent();
        Load += Form1_Load;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        axMap1.SendMouseMove = true;
        axMap1.MouseMoveEvent += AxMap1_MouseMoveEvent;
        axMap1.SendMouseDown = true;
        axMap1.MouseDownEvent += AxMap1_MouseDownEvent;
        axMap1.SendSelectBoxFinal = true;
        axMap1.SelectBoxFinal += AxMap1_SelectBoxFinal;
        axMap1.CursorMode = MapWinGIS.tkCursorMode.cmSelection;
        axMap1.MapCursor = MapWinGIS.tkCursor.crsrArrow;
    }

    private void AxMap1_MouseMoveEvent(object sender, AxMapWinGIS._DMapEvents_MouseMoveEvent e)
    {
        Text = $"on mouse move x:{e.x} y:{e.y}";
        Console.WriteLine(Text);
    }


    private void AxMap1_SelectBoxFinal(object sender, AxMapWinGIS._DMapEvents_SelectBoxFinalEvent e)
    {
        Text = "on select box final";
        Console.WriteLine(Text);
    }


    private void AxMap1_MouseDownEvent(object sender, AxMapWinGIS._DMapEvents_MouseDownEvent e)
    {
        Text = "on mouse down";
        Console.WriteLine(Text);
    }

I mentioned earlier that axMap.SelectBoxFinal does not work. I was wrong. It does work.

The axMap.MouseDownEvent does not work for me.

Hello @RaffyM

I’m glad that you noticed this. I found the issue.

Historically, in cmSelection mode, the MouseDown event was fired only if no LayerHandle was specified in the ChooseLayer event handler. This is your case. You have enabled the cmSelection tool, but have not specified a layer handle in the ChooseLayer event.

However, when new functionality was added to allow for multiple ‘Selectable’ layers, we lost the mouse event altogether. To be consistent with historical behavior, you should get the MouseDown event if

  1. You do not specify a layer handle in the ChooseLayer event, and
  2. You do not flag any layers as ‘Selectable’

I will need to make a change to account for item 2.

Regards,
Jerry.

Ok. I have made the change to fix this bug, and have updated MWGIS-139 accordingly.

@pmeems, should this be a new Jira ticket instead of piggy-backing on the original?