Stuart, Hiding/showing layers is slightly tricky (or at least non-obvious). I'm still working on examples in the documentation that should make it a lot clearer.
In a nutshell, you need to actually show/hide the layer elements themselves. You can get the layer's element (referred to as a widget's "container" element) using *LayoutPanel.getWidgetContainerElement(Widget). Showing/hiding this element rather than the widget itself should get rid of any event problems. I'll make a point to add an example of this to the documentation. I didn't want to require the existence of the elements, but it proved impossible to support arbitrary CSS any other way (the existence of these elements makes it possible to efficiently account for margins, borders, and padding on the child widgets' elements). Cheers, joel. On Thu, Nov 26, 2009 at 2:33 AM, Stuart Moffatt <[email protected]>wrote: > > Env: GWTRC2 Safari Mac OS X. > > UI binding: > {{{ > <g:LayoutPanel ui:field="layoutPanel"> > <g:layer> > <myclient:MyEditor ui:field='myEditor'/> > </g:layer> > <g:layer> > <myclient:MyLister ui:field='myLister'/> > </g:layer> > </g:LayoutPanel> > }}} > > These two custom widgets sit right on top of each other visually. The > reason is I want them to "replace" each other. Since MyLister is added > last, I can trigger events from it. When I fire a certain event from > MyLister, MyLister hides via setVisible(false) and MyEditor displays > via setVisible(true) However, because MyEditor is a layer "below" > MyLister, all events are hidden. E.g. onClick in widget in MyEditor > does not fire. > > Is there any way (declaratively or programmatically) to swap the > positions of the layers so that the visible layer is "on top" and can > respond to events? > > sfm > > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
