[Users] Toggle groups and select tool not working

Robert Buckley robertdbuckley at yahoo.com
Thu Oct 7 11:34:01 CEST 2010


Hi,

I have the following problem. I have a toolbar with a select tool enabling the 
user to click on a feature and get the popup info. Also on the toolbar there is 
a menu with measure tools (area/line).
When I "F5" the select tool works ok with the other navigation tools. But as 
soon as I measure, the select tool doesn´t get activated again and stays a 
measure tool.

Here is the project and the code for the select tool and measure tools is posted 
underneath.

http://85.214.225.9:8080/geoserver/www/zgb_energie/index.html

If anyone can see an error I´d be saving a few grey hairs.

Thanks,

Robert Buckley


//select control
         action = new GeoExt.Action({
           text: "",
         tooltip: "Features selektieren",
         icon: '../images/information.png',
         toggleGroup: toggleGroup,
         group: 'toggleGroup',
            control: new OpenLayers.Control.SelectFeature(
        [layer_wea,layer_biogas,layer_wasserkraft,layer_kraftwerke],
                {
                    
                }
        ),
          map: map
         });
    actions["Select"] = action;
       toolbarItems.push(action);
    toolbarItems.push(' ',' ',' ',' ');
        
    
     // Measure area control    
          action = new GeoExt.Action({
            text: "Flächen",
          toggleGroup: toggleGroup,
          group: 'toggleGroup',
             control: new OpenLayers.Control.Measure(OpenLayers.Handler.Polygon, 
{
             eventListeners: {
             measure: function(evt) {
            Ext.MessageBox.show(
            {
                title: 'Flächenberechnung',
                buttons: Ext.MessageBox.OK,
                width: 200,
                msg: "Area: " + evt.measure.toFixed(2) + evt.units + "²",
                fn: check
            });
                    }
            }
            }),
          map: map
         });
        actions["area"] = action;

    
        // Measure line control    
         action = new GeoExt.Action({
           text: "Entfernung",
        toggleGroup: 'toggleGroup',
        group: 'toggleGroup',
            control: new OpenLayers.Control.Measure(OpenLayers.Handler.Path, {
             eventListeners: {
             measure: function(evt) {
            Ext.MessageBox.show(
            {title: 'Entfernung Messen'
            ,buttons: Ext.MessageBox.OK
            ,width:200
            ,msg:"Entfernung: " + evt.measure.toFixed(2) + evt.units,
            fn: check
            });
                    }
            }
            }),
          map: map
         });
        actions["line"] = action;
        
    
    
    toolbarItems.push({
        text: "",
        icon: '../images/ruler.png',
        tooltip: "Messwerkzeuge",
        toggleGroup: toggleGroup,
        group: 'toggleGroup',
        menu: new Ext.menu.Menu({
             
            items: [
             new Ext.menu.CheckItem(actions["area"]),
             new Ext.menu.CheckItem(actions["line"])
             
            ]
                    
        })
    });




More information about the Users mailing list