<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Also,<br>
<br>
you could concentrate on your css styles. I really don't understand
them, but they have something to do with the functioning. If I add
'ItemInactive' into your style in Firebug, the button works. Maybe <b>*someone
could explain*</b> this button thing to us who don't get it. I have
been using the following styles and activating/deactivating my buttons
by demand.<br>
<br>
&nbsp;&nbsp;&nbsp; .olControlPanel div {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; display:block;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; width:&nbsp; 24px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; height: 24px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; margin: 5px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; background-color:red;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; position: absolute;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; top: 100px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; left: 10px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; .olControlPanel .infoItemActive&nbsp; { <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; background-color: green;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; background-image: url("./OpenLayers-2.7/info_on.png");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; position: absolute;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; top: 140px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; left: 10px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; .olControlPanel .infoItemInactive { <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; background-color: blue;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; background-image: url("./OpenLayers-2.7/info_off.png");<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; position: absolute;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; top: 140px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; left: 10px;<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
<br>
Of course you have to change the displayClass ( Mine is 'info' in this
example.) This cretes two-state button (different image when on and
off).<br>
<br>
- mika -<br>
<br>
Arnd Wippermann kirjoitti:
<blockquote cite="mid:E1LUR6B-0005Oe-00@smtp07.web.de" type="cite">
  <pre wrap="">Hi,

Perhaps you have to activate the control:
panel.activateControl(button);

Arnd Wippermann
 

-----Urspr&uuml;ngliche Nachricht-----
Von: <a class="moz-txt-link-abbreviated" href="mailto:users-bounces@openlayers.org">users-bounces@openlayers.org</a> [<a class="moz-txt-link-freetext" href="mailto:users-bounces@openlayers.org">mailto:users-bounces@openlayers.org</a>] Im
Auftrag von JuergenL
Gesendet: Dienstag, 3. Februar 2009 19:56
An: <a class="moz-txt-link-abbreviated" href="mailto:users@openlayers.org">users@openlayers.org</a>
Betreff: [OpenLayers-Users] Problem with OpenLayers.Control.Button

Hi,

I'm new to OpenLayers and I try to add my own button to OpenLayers that
calls a JavaScript function when clicked. The button is visible but nothing
happens when I click on it.

That's how I define the button:

            var panel = new OpenLayers.Control.Panel();
            var button = new OpenLayers.Control.Button({displayClass:
"addMarkerBtn", trigger: addMarker});
            panel.addControls([button]);
            map.addControl(panel);

And the function addMarker:

        addMarker = function() {
            alert('test');
        }

I also tried

        function addMarker() {
            alert('test');
        }

Here is a complete test page: <a class="moz-txt-link-freetext" href="http://albspotter.org/osm/test.php">http://albspotter.org/osm/test.php</a>

Can anyone tell why this doesn't work?

Thanks in advance
Juergen
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@openlayers.org">Users@openlayers.org</a>
<a class="moz-txt-link-freetext" href="http://openlayers.org/mailman/listinfo/users">http://openlayers.org/mailman/listinfo/users</a>
  </pre>
</blockquote>
</body>
</html>