On Nov 16, 2007 4:14 PM, Pascal Ehlert <[EMAIL PROTECTED]> wrote: > Hi mailing list! > > I'm trying to build my own control to enable the user to query some > information depending on where he clicked. > Now I'd like to add this control to my panel and change between > normal navigation and query mode. > > Unfortunately there are two problems with it: > The first is that the class for the control element in my panel > doesn't change to olControlODAQueryItemActive when I click it,
To get OpenLayers to use the classes olControlODAQueryItemActive and olControlODAQueryItemInactive for your control you need to place it in an OpenLayers panel. See <http://www.openlayers.org/dev/examples/panel.html> for an example on how to use a panel. You'd also need to declare your control using something like that: OpenLayers.Control.ODAQuery = OpenLayers.Class(OpenLayers.Control, { initialize: function(options) { OpenLayers.Control.prototype.initialize.apply(this, [options]); }, CLASS_NAME: "OpenLayers.Control.ODAQuery" }); OpenLayers will derive class names (olControlODAQueryItemActive and olControlODAQueryItemInactive) from your control's CLASS_NAME property. This occurs in the Control.Panel code (see <http://trac.openlayers.org/browser/trunk/openlayers/lib/OpenLayers/Control/Panel.js>). > although the > event is registered. > The second is that I don't really know how to unregister it so that > normal navigation is possible again. Your class should override the unactivate() method and call this.map.unregister() from this method. > > Oh, okay, there's just another problem that came to my mind: > I'd also like it to unregister all default mouse handlers upon > activation, so that you can't navigate in query mode. Hmm, if you register a callback for the click event only, you should still be able to navigate. Go back to us with examples if that doesn't work. -- Eric _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users