[OpenLayers-Users] Add custom control, possible?

Planet)x andrew.stewart at reddeer.ca
Tue Aug 10 11:54:36 EDT 2010


I am trying to add a custom control to my existing panel. All I want to do is
edit an existing control like MouseDefaults.js and create a simple control
that will just refresh the page, I called it Home.js. However when I copy
the exact code in MouseDefaults.js and change everything to be called Home
instead, I try to add this control to my panel with the following code but I
just keep getting the same error that it is missing an object. Even though I
have copied the exact code from a seperate control. Any suggestions
appreciated on how to add my own custom control, thanks.


            var panel = new OpenLayers.Control.Panel({defaultControl: zb});
            panel.addControls([
                new OpenLayers.Control.MouseDefaults(
                    {title:'Pan Tool - Click and drag on map window'}), 
                zb,
                new OpenLayers.Control.DrawFeature(vlayer,
OpenLayers.Handler.Path,
                    {title:'Draw a feature'}),
                new OpenLayers.Control.ZoomToMaxExtent({title:"Zoom to the
max extent"}),
                new OpenLayers.Control.Home({title:"Zoom to the max
extent"})    <---- here is where it fails?
            ]);
-- 
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Add-custom-control-possible-tp5393642p5393642.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.



More information about the Users mailing list