FunctionMode.Info throws error

Feb 4, 2013 at 11:00 AM
When I use FunctionMode.Info, on mouse click, with more than one it generates error "Form that is already visible cannot be displayed as a modal dialog box"

map1.FunctionMode = DotSpatial.Controls.FunctionMode.Info;

What should I do?? Please suggest
Feb 4, 2013 at 6:00 PM
Edited Feb 4, 2013 at 6:02 PM
Don't really understand you want to do, but if you want to change the property form "FeatureIdentifier" that is within DotSpatial.Controls.FeatureIdentifier.cs, you can do modifying the form directly from Dotspatial.Controls and recompile the project again DotSpatial.Controls.dll

Carefully...
Identify form shooting with the instruction map1.FunctionMode = DotSpatial.Controls.FunctionMode.Info;


Sorry for my english... :D
Feb 5, 2013 at 1:47 AM
Thank you Camiza...Can I use FeatureIdentifier's object direcly for mouse click on features of map.
Feb 6, 2013 at 3:03 AM
I have done this way and its working now :)

private void map1_MouseUp(object sender, MouseEventArgs e)
    {
        if (e.Button != MouseButtons.Left) return;
        Rectangle rtol = new Rectangle(e.X - 8, e.Y - 8, 16, 16);
        Rectangle rstr = new Rectangle(e.X - 1, e.Y - 1, 2, 2);
        Extent tolerant = map1.PixelToProj(rtol);
        Extent strict = map1.PixelToProj(rstr);

        if (_frmFeatureIdentifier == null)
        {
            _frmFeatureIdentifier = new FeatureIdentifier();
        }
        _frmFeatureIdentifier.SuspendLayout();
        _frmFeatureIdentifier.Clear();
        Identify(map1.MapFrame.GetLayers(), strict, tolerant);
        _frmFeatureIdentifier.ReSelect();
        _frmFeatureIdentifier.ResumeLayout();
        if (_frmFeatureIdentifier.Visible == false)
        {
            _frmFeatureIdentifier.Show(map1.MapFrame != null ? map1.MapFrame.Parent : null);
        }
        base.OnMouseUp(e);
    }

    private void Identify(IEnumerable<ILayer> layers, Extent strict, Extent tolerant)
    {
        foreach (IMapLayer layer in layers)
        {
            IGroup grp = layer as IGroup;
            if (grp != null)
            {
                Identify(grp, strict, tolerant);
            }
            else
            {
                var gfl = layer as IMapFeatureLayer;

                if (gfl != null)
                {
                    if (gfl.DataSet.FeatureType == FeatureType.Polygon)
                    {
                        _frmFeatureIdentifier.Add(gfl, strict);
                    }
                    else
                    {
                        _frmFeatureIdentifier.Add(gfl, tolerant);
                    }
                }

                /*
                var rl = layer as IMapRasterLayer;
                if (rl != null)
                {
                    //_frmFeatureIdentifier.Add(rl, strict);
                    MessageBox.Show("check it --> _frmFeatureIdentifier.Add(rl, strict);");
                }
                */
            }
        }
    }
Apr 29, 2013 at 7:20 AM
Hello kabpraise63,

I think I'm dealing with the same problem of functionmode.info.
Did you solve the problem by editing the sourcecode and recompiling the DotSpatial.Controls.dll?
If so: would you mind sharing the recompiled library?

Thanks in advance,
Claudia
Coordinator
Apr 30, 2013 at 1:31 PM
Claudia,

I just tried to duplicate this error, but I can't. I recall that we fixed something like this in December, so maybe you just need the latest version of the code/DLL's? I know we haven't updated the official download in a while, but you can get the source and compile. Or I can send you the compiled DLL's from the current source.
  • Dan
Apr 30, 2013 at 8:55 PM
Hi Dan,

If it doesn't cause you too much inconvenience sending me the compiled DLL containing the fix, I'd really appreciate it.
Should I send you an email you can reply to?

Thanks a lot
Claudia
Coordinator
May 1, 2013 at 1:39 PM
OK you inspired me to put together the first experimental release of DotSpatial 1.5. We're working on a new recommended release called 1.5 and probably won't have it ready for a few months. But the plan is to release incremental "experimental" releases called 1.5.1, 1.5.2 etc. I just uploaded the DLL's for "1.5.1 Experimental" here: https://dotspatial.codeplex.com/releases/view/105957. You'll need to replace all of your DotSpatial DLL's since these are all compiled to work together. Let me know if it fixes the problem with FunctionMode.Info... - Dan
May 2, 2013 at 11:57 AM
Hello Dan,

I replaced all of the DotSpatial DLL's, and it fixes the problem with FunctionMode.Info

But then got 3 error messages when I started my application:
'A IDockManager / IHeaderControl / IStatusControl extension must be included because a UI plugin was found. See http://wp.me/pvy5A-2v'
Removing the AppManager (which I didn't need anymore) solved this.

Thanks
Claudia
Coordinator
May 3, 2013 at 3:52 PM
OK I'm glad this worked. You are now the first official user of the 1.5 alpha version of DS. There will likely be more changes to the code in 1.5 before it becomes a recommended release but hopefully nothing that would thwart your project. Thanks for letting me know how this went. Probably you've got a plugin DLL somewhere in your folder that the appmanager was trying to load. - Dan