O'Reilly logo

OpenLayers 2.10 by Erik Hazzard

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating our own controls

You're familiar (or perhaps fed up) with control descriptions by now. Let's make things a little more interesting and create our own control. Here's the plan:

  1. Quickly talk about the Button Control class.
  2. Create a Button control with custom functionality.
  3. Add the button to a panel.
  4. Viola! You just created your own custom control.

So, before we talk about creating a custom button, let's go over the Button subclass that we didn't cover in the section above, which we'll use to create our custom controls.

OpenLayers.Control.Button

There's not much to cover here really, as we've been over the base control class. There are two properties we need to discuss however—the type and displayClass property. We'll use these two properties when ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required