How do I get mouse events to click through the PopUp panel (when it is
highlighted) so that the FlexTable w/FocusPanel under the PopUp gets
the event?

The below code should be functional so you can see what I'm talking
about. When the highlight button is pressed the PopUp panel goes ontop
of the FlexTable/FocusPanel and Only the PopUp gets the events. When
the unhighlight button is pressed the PopUp is removed and the
FlexTable/FocusPanel once again receive the events.

I want to use these transparent PopUps to cover Ranges of Cells within
FlexTables and I need the user to be able to click on a highlighted
Cell and that cell receive the events.

I understand that I can highlight the cells themselves with CSS, I am
already doing that for a different purpose.

Thanks for the help,

__________________________________________________________________________________________

public class Tester implements EntryPoint {

  FlexTable flexTable = new FlexTable();
  OvrLay ovrLay = new OvrLay();
  int colWidth = 100;
  int colHeight = 100;
  int topX = 0;
  int topY = 0;

  public void onModuleLoad() {

    BaseCell baseCell = new BaseCell();
    baseCell.setPixelSize(100, 100);
    flexTable.setWidget(0, 0, baseCell);

    RootPanel.get().add(flexTable);

    final Button highlightButton = new Button("Highlight");
    highlightButton.addClickHandler(new ClickHandler() {
      public void onClick(ClickEvent event) {
        highLight();
      }
    });

    final Button unhighlightButton = new Button("Unhighlight");
      unhighlightButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
          unhighLight();
      }
    });

    RootPanel.get().add(unhighlightButton);
    RootPanel.get().add(highlightButton);

  }

  public void highLight() {
    ovrLay.setSize(colWidth + "px", colHeight + "px");
    DOM.setStyleAttribute(ovrLay.getElement(), "border", "1px solid
black");
    RootPanel.get().add(ovrLay, topX, topY);
  }

  private void unhighLight() {
    ovrLay.removeFromParent();
  }

  class OvrLay extends PopupPanel {
    public OvrLay() {
      super(false,false);
      DOM.setStyleAttribute(getElement(), "opacity", ".4");
      DOM.setStyleAttribute(getElement(), "filter", "alpha
(opacity=40)");
      SimplePanel simplePanel = new SimplePanel();
      DOM.setStyleAttribute(simplePanel.getElement(), "opacity", ".
4");
      DOM.setStyleAttribute(simplePanel.getElement(), "filter", "alpha
(opacity=40)");
      add(simplePanel);
      setAnimationEnabled(false);
      sinkEvents(Event.MOUSEEVENTS);
    }

    public void onBrowserEvent(Event event) {
      if(event.getTypeInt()==Event.ONMOUSEDOWN)
        Window.alert("OvrLay onMouseDown event");
    }
  }

  class BaseCell extends FocusPanel {
    public BaseCell() {
      super();
      addMouseDownHandler(new MouseDownHandler() {
        public void onMouseDown(MouseDownEvent event) {
          Window.alert("BaseCell onMouseDown event");
        }
      });
    }
  }
}

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.


Reply via email to