1
votes

Using GWT 2.0 I have an entry point that adds two Widgets to a LayoutPanel which in turn is added to the RootLayoutPanel. The Widgets both handle click events and have click events registered to them. The problem is that only the last widget added to the LayoutPanel can actually be clicked. Switch the order in which the widgets are added switches the widget that works. Add mroe widgets and still the only you can click is the last one added to the LayoutPanel.

Any idea why this is? Is there any reasoning behind the behaviour, or have I missunderstood what is happening under the covers? How do I gat all widgets in the LayoutPanel to accept events? Should I be using another panel class?

I'm not too bothered if the LayoutPanel prevents anything below it from being clicked, but want all Widgets added to it to be clickable.

1
How are you adding the click handlers? Can you paste the relevant code sections? It should work .. I am guessing there is some bug in the way you are adding handlers.Sripathi Krishnan
This is why I use FocusPanel in these situations - let the GWT team worry about handling the ClickHandlers, not me ;)Igor Klimer
I've just tried to build a very simplified test case to demonstrate the problem. But the problem didn't apear. I'll update in a minute with more info.Kerr

1 Answers

0
votes

Stupid Boy! (said in the voice of Captain Mainwaring)

There is no problem having two Widgets on a LayoutPanel accepting clicks. But if you adjust the Widgets' size by manipulating their elements' styles directly then the containing element created by the LayoutPanel will still cover the whole screen. In effect the last Widget added always covered everything else.

GWT school: D- Must try harder. Easily distracted...