Hi All, I'm running into a bit of a snag and am hoping someone can offer some advice. I'm trying to build a map with multiple control panels, ie: Basic Navigation, Querying (draw a shape, generate a query based off the shape) etc. For the most part its going quite well, but I'm running into a problem where I activate a control in one panel, click on a button in another panel, and the original controls remain active and both try to run... in other words, I'll turn on an Info control, and then switch to DrawPoint, and it'll be trying to do both. Controls deactivate other controls within their own panel when clicked, but don't seem to know to deactivate the other panel's controls.
Is there a straightforward way to do this? Thus far, the best idea I've come up with (shown below) is setting a listener for each control when it activates, such that it runs through everything in the other panel.controls, and deactivates them all. This strikes me as painfully awkward, and gets extremely annoying to scale if I choose to add a few more panels. Is there any way to make the panels aware of each other's existence such that they deactivate the controls appropriately (or can anyone suggest a better of implementing this)? Thanks! Josh given two external panels, panel and selPan2, run the following at the end of initialization. for (eachControl in panel.controls) { panel.controls[eachControl].events.register("activate",selPan2.controls,function () { for (otherControls in this) { this[otherControls].deactivate(); } }); } for (eachControl in selPan2.controls) { selPan2.controls[eachControl].events.register("activate",panel.controls,function () { for (otherControls in this) { this[otherControls].deactivate(); } }); }
_______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users