Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying OpenLayers 2.10 Beginner's Guide
  • Table Of Contents Toc
  • Feedback & Rating feedback
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)
close
close
OpenLayers 2.10 Beginner's Guide

OpenLayers 2.10 Beginner's Guide

4.2 (9)

Overview of this book

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

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 creating our own custom control.

Button properties

Name

Type

Description

Default Value

type

{Integer}

This is an integer which represents the type of control this button is. This is part of what we discussed earlier—the button types. OpenLayers...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY