Reputation: 2156
Suppose the following.
I have a an AbsolutePanel. On this AbsolutePanel I add a button. Finally I add another AbsolutePanel on top of all this with the same size as the first AbsolutePanel.
Now when I click on the button the click gets intercepted by the second AbsolutePanel. Is there a way that I can let the second AbsolutePanel ignore, or give through the event so that the button receives the event ?
AbsolutePanel abs1 = new AbsolutePanel();
abs1.setSize("500px", "500px");
Button button = new Button("abc");
abs1.add(button, 50, 50);
AbsolutePanel abs2 = new AbsolutePanel();
abs2.setSize("500px", "500px");
abs1.add(abs2, 0, 0);
button.addClickHander...
Upvotes: 1
Views: 50
Reputation: 41089
You have two options:
Add a button after adding an absolute panel.
Instead of adding the second absolute panel, you can insert it just before the button.
Upvotes: 1
Reputation: 628
Well, as far as I can see, reading AbsolutePanel
's JavaDoc:
An absolute panel positions all of its children absolutely, allowing them to
overlap
I think for some reason you feel good 'playing' with absolute css positioning. So, I think under your circumstances if you just apply a z-index
css value to button
higher than abs2
's z-index
, solve your problem.
I tested personally, and it works, but remember, the button will be 'over' abs2
.
Upvotes: 2