[OpenLayers-Users] adding buttons to OL UI

Eric Lemoine eric.c2c at gmail.com
Sun Sep 14 16:22:18 EDT 2008


Hi

If i had to do that i'd create two button controls (i.e. two instances
of Control.Button), one per baselayer, and add them to a panel (an
instance of Control.Panel).

To create a button you'd use something like that:

var button = new OpenLayers.Control.Button({trigger: function() {
map.setBaseLayer(yourBaseLayer1); }});

To create a custom panel look at the panel.html example.

Hope this helps.
--
Eric

2008/9/12, slyon <skylar at ccri.com>:
>
> Howdy all,
>
> I've got two baselayers in my OL map currently. Instead of them displaying
> in the LayerSwitcher I'd like to add two buttons to the map that correspond
> to the baselayers. Is this easily done? I've been searching the forums, but
> haven't found much.
>
> So, if anyone can tell me how to add buttons to the map that I can tie to
> the baselayers that would be very helpful.
>
> Thanks,
> Skylar
> --
> View this message in context:
> http://www.nabble.com/adding-buttons-to-OL-UI-tp19460603p19460603.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list