Hi Frederick,
supposing that the Control.Click looks like the one described in [1] you
could achieve the desired behaviour like this (untested, sorry):
HTML:
<a href="#" onclick="return toggleClickControl();">toggle click-control</a>
JavaScript:
var toggleClickControl = function(){
// supposing you have only one click-control
// another reference to the control should work as well: e.g. a
global variable
// caution: [1] does NOT define CLASS_NAME
var ctrls = map.getControlsBy('CLASS_NAME', 'OpenLayers.Control.Click');
var ctrl = (ctrls && typeof ctrls[0] !== 'undefined') ? ctrls[0] : null;
if (ctrl !== null) {
// check current state
if (ctrl.active) {
ctrl.deactivate();
} else {
ctrl.activate();
}
}
return false;
}
Regards,
Marc
[1] http://openlayers.org/dev/examples/click.html
Am 12.01.2011 20:37, schrieb Frederick Löbig:
Hey list,
I have a very simple problem and I know, that the solution will be
really simple, yet I haven't found it.
I'm loading a map and add the click control by using
...
var click = new OpenLayers.Control.Click();
map.addControl(click);
click.activate();
...
Now I want to disable this control when I click on a link on the page.
I also want to activate the control again by clicking again. I know
that I need something like a toggle function, but what I found on the
web doesn't inspire me for a simple solution.
Can you help me with that?
Best,
Freddy
**Frederick Löbig*
Röderichstraße 59
60489 Frankfurt am Main
---
E:: [email protected] <mailto:[email protected]>
P: +49 (0) 69 - 78 99 52 41
M: +49 (0) 174 - 70 89 296
---
*Office:*
*euNetworks GmbH*
Ludwig-Landmann-Straße 405
60486 Frankfurt am Main
P: +49 (0) 69 - 90 554 - 532
E: [email protected]
<mailto:[email protected]>
S: floebig
This email and any attachments may contain confidential and/or legally
privileged information. If you are not the intended recipient, please
delete the email without reading it and notify the sender.
*
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users