[OpenLayers-Users] Custom EditingToolbar displays the wrong button icon

Adrian Popa adrian_gh.popa at romtelecom.ro
Mon Jul 5 08:27:41 EDT 2010


Hello everyone,

Long time no see :)

I want to add a "save" button to my editingToolbar (which was 
customized) in order to manually save changes. I am using the following 
code:

   //overload the EditingToolbar initialize function:
     OpenLayers.Control.EditingToolbar.prototype.initialize = 
function(layer, options){
             OpenLayers.Control.Panel.prototype.initialize.apply(this, 
[options]);

         this.addControls(
           [ new OpenLayers.Control.Navigation() ]
         );
         var controls = [
           new OpenLayers.Control.DrawFeature(layer, 
OpenLayers.Handler.Point, {'displayClass': 'olControlDrawFeaturePoint'}),
           new OpenLayers.Control.Button({ title: "Save changes",
                                                   trigger: function() {
                                                       saveStrategy.save();
                                                   },
                                                   displayClass: 
"olControlSaveFeatures"
                                                   })
         ];
         this.addControls(controls);

     };
     editingToolbar = new OpenLayers.Control.EditingToolbar( 
editableLayer ) ;
     map.addControl( editingToolbar );

Everything works as expected, but there is only one problem. In the 
toolbar I get instead of the "save_features_off.png" icon the "move" 
icon.  Playing with firebug I can see that the active CSS for the 
toolbar (.olControlEditingToolbar) overrides 
".olControlSaveFeaturesItemInactive" and overrides the image. If I 
disable the background-image statement from .olControlEditingToolbar I 
can see the save icon. Most likely the move icon is on top of the save 
icon...

Any ideas on how to fix this - even as a hack?

Thanks.

I attached some small screenshots to illustrate this.

Regards,
Adrian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2010-07-05_15-24-56_160x47.png
Type: image/png
Size: 2449 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100705/9c97e602/2010-07-05_15-24-56_160x47.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2010-07-05_15-25-16_495x214.png
Type: image/png
Size: 18990 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100705/9c97e602/2010-07-05_15-25-16_495x214.png


More information about the Users mailing list