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:
Quickly talk about the Button Control class.
Create a Button control with custom functionality.
Add the button to a panel.
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 |
|
This is an integer which represents the type of control this button is. This is part of what we discussed earlier—the button types. |