Book Image

OpenLayers 2.10 Beginner's Guide

Book Image

OpenLayers 2.10 Beginner's Guide

Overview of this book

Table of Contents (18 chapters)
OpenLayers 2.10
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Panels


So far, we've covered the most common controls, ones that we'll be using throughout the book. There is another type of control that we have not yet discussed—the panel control. It is a container, a control that allows us to add and group together other controls inside of a (you guessed it) panel. We have, in fact, encountered the panel control to some degree with a few of the controls we've discussed. The PanPanel and ZoomPanel controls are actually panels which contain other controls.

Control types

With a panel, each control is represented by an icon (which can be styled anyway you wish). When the icon is clicked, the activateControl method of that control is called. Remembering to call activateControl is very important—most controls will not activate by themselves (we'll cover this in more detail soon). Some of the controls we've encountered can be placed inside a panel, as we'll see in a moment.

Each control in a panel has one of the three 'types':

  • OpenLayers.Control.TYPE_BUTTON: This...