Select to view content in your preferred language

Idenfity widget - Clear Results on Close

861
5
08-17-2011 11:38 AM
EricVenden
Frequent Contributor
Greetings all,

Has anyone tweaked Robert's Identify widget (I'm using the 2.4 viewer version) to clear the results when the widget is closed?  By default, the widget after being closed and then opened back up - highlights the previously identified feature (unless the user clicked the clear button).  I am also looking to change the widget so that when the user opens it back up, the widget's "starting point" is set so that they can just click on another feature.  It appears that even if I have the autoactivated tool option set in the config xml, it does not honor this after closing and then reopening the widget.

Thanks for your time.
Eric V
Gurnee, IL
Tags (2)
0 Kudos
5 Replies
RobertScheitlin__GISP
MVP Emeritus
Eric,

   Clearing the results on widget close would be as simple as adding the clear(); function to the widgetClosedHandler...

            private function widgetClosedHandler(event:Event):void
            {
                clear();
                setMapAction(null, null, null, null);
                graphicsLayer.visible = false;
                hideInfoWindow();
                setMapNavigation(null, null);
                
                if (selectedDrawingIcon)
                    selectedDrawingIcon = null;
            }


Your second request just as simple 2 lines this time:

            private function widgetOpenedHandler(event:Event):void
            {
                if(graphicsLayer)
                    graphicsLayer.visible = true;
                
                if (autoActivatedTool != "" )
                    activateIdentifyTool(null, autoActivatedTool);
            }
0 Kudos
EricVenden
Frequent Contributor
Eric,

   Clearing the results on widget close would be as simple as adding the clear(); function to the widgetClosedHandler...

            private function widgetClosedHandler(event:Event):void
            {
                clear();
                setMapAction(null, null, null, null);
                graphicsLayer.visible = false;
                hideInfoWindow();
                setMapNavigation(null, null);
                
                if (selectedDrawingIcon)
                    selectedDrawingIcon = null;
            }


Your second request just as simple 2 lines this time:

            private function widgetOpenedHandler(event:Event):void
            {
                if(graphicsLayer)
                    graphicsLayer.visible = true;
                
                if (autoActivatedTool != "" )
                    activateIdentifyTool(null, autoActivatedTool);
            }


Nice..Thanks Robert..I was close, but kept coming up with an error on recompile..case sensitivity, ugh.
Eric
0 Kudos
EricVenden
Frequent Contributor
Robert,
After adding the code you posted, the pan does not work while the identify is active.  It did work before the code was added.  Any ideas?

Thank you
Eric V
Gurnee,IL
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Eric,

   Are you using version 2.4.0.1?

Does your activateIdentifyTool function look like this:

            private function activateIdentifyTool(event:MouseEvent, lTool:String = ""):void
            {
                addSharedData("Deactivate_DrawTool", null); // to be able to deactivate drawTool on other widgets
                
                // apply glow
                if(event){
                    selectedDrawingIcon = Image(event.currentTarget);
                }else{
                    switch(lTool){
                        case DrawTool.EXTENT :
                        {
                            selectedDrawingIcon = iDrawExt;
                            break;
                        }
                        case DrawTool.POLYGON :
                        {
                            selectedDrawingIcon = iDrawPoly;
                            break;
                        }
                        case DrawTool.MAPPOINT :
                        {
                            selectedDrawingIcon = iDrawPnt;
                            break;
                        }
                        case DrawTool.POLYLINE :
                        {
                            selectedDrawingIcon = iDrawLine;
                            break;
                        }
                        default:
                        {
                            selectedDrawingIcon = iDrawPnt;
                        }
                    }
                    
                }
                clearSelectionFilter();
                selectedDrawingIcon.filters = [ glowFilter ];
                
                var status:String;
                var value:String = selectedDrawingIcon.name;
                
                lastTool = selectedDrawingIcon.name;
                setMapNavigation("none", "");
                switch (value)
                {
                    case DrawTool.MAPPOINT:
                    {
                        status = pointLabel;
                        setMapAction(DrawTool.MAPPOINT, status, identMarkerSymbol, drawEnd, false);
                        break;
                    }
                    case DrawTool.POLYLINE:
                    {
                        status = lineLabel;
                        setMapAction(DrawTool.POLYLINE, status, identLineSymbol, drawEnd, false);
                        break;
                    }
                    case DrawTool.EXTENT:
                    {
                        status = rectLabel;
                        setMapAction(DrawTool.EXTENT, status, identFillSymbol, drawEnd, false);
                        break;
                    }
                    case DrawTool.POLYGON:
                    {
                        status = polyLabel;
                        setMapAction(DrawTool.POLYGON, status, identFillSymbol, drawEnd, false);
                        break;
                    }
                }
            }
0 Kudos
EricVenden
Frequent Contributor
Thanks for pointing me in the right direction Robert...I found the issue.
Thanks again
Eric V
0 Kudos