This project has moved and is read-only. For the latest updates, please go here.

Problem with MapBox switching ActiveTool from QueryGeometry to None

Topics: SharpMap v0.9 / v1.x, WinForms Controls
Dec 6, 2012 at 10:42 AM

Hello,

This is what I found out not to work well (in 0.9.4507.23599):
I have a form with (among others) a MapBox and a ToolStrip. On that ToolStrip are some buttons, and they do switching the MapBox's ActiveTool.

For example:

private void selectToolStripButton_Click(object sender, EventArgs e)
{
mapBox.ActiveTool = SharpMap.Forms.MapBox.Tools.None; }
 
private
 void zoomWindowToolStripButton_Click(object sender, EventArgs e) {     mapBox.ActiveTool = SharpMap.Forms.MapBox.Tools.ZoomWindow; }

private
 void infoToolStripButton_Click(object sender, EventArgs e) {     mapBox.ActiveTool = SharpMap.Forms.MapBox.Tools.QueryGeometry; }

When the ActiveTool is QueryGeometry (and maybe also Query and QueryBox, but I don't use them), I can't switch back to None, I must press the selectToolStripButton twice. There is no problem with the other ActiveTool's.....

Any clue? Must I execute mapBox.ActiveTool = SharpMap.Forms.MapBox.Tools.None twice in selectToolStripButton_Click with a delay inbetween?

Have a nice day,

Pieter

Dec 6, 2012 at 10:44 AM

Hi, do you have the property of mapbox "setToolsNoneWhileDrawing" set to true or false?

Dec 6, 2012 at 12:32 PM

Hello petlof,

Thanks for your quick answer. "SetToolsNoneWhileDrawing" is set to true. When I set it to false, it works as it should. But it has another drawback: mapBox_MapRefreshed is never called anymore, even when I call mapBox.Refresh(). Alas, I need it...

In my original post I said that I had to click twice on the selectToolStripButton. Well, it was once on the panToolStripButton (switch to Pan), then on the selectToolStripButton (switch to None).

Pieter

Dec 6, 2012 at 12:39 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.