Re: 1 MapMouseListener for 2 or more layers

From: alexander sokolov <sokolov@system.ecology.su.se>
Date: Mon Nov 19 2001 - 09:10:38 EST

> I wonder if it is possible to have two layers with MapMouseListeners
> implemented
> in each one and to control the map objects of these two layers at the same
> time,
> without switching one of the layers off.
> I have the problem that only one layer can react to the mouse actions, this
> is the
> layer which lies on top of all layers that implement MapMouseListeners.

Just make sure that your mouseClicked (or mousePressed etc) method
return true. Otherwise the MouseEvent will be "consumed" by layer

  public boolean mouseClicked(MouseEvent e) {
    boolean consumeEvent = false;
    if (masterList != null) {
      OMGraphic obj = masterList.findClosest(e.getX(), e.getY(), 1.0f);
      if (obj != null) {

// something useful

        consumeEvent = true;
      }
    }
    return consumeEvent;
  }

as

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Nov 19 09:12:12 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT