Wednesday, December 3, 2014

Re: TabLayoutPanel - forcing onResize for unselected tab content

I am using the following class.


package com.sn.lib.gwt.client.ui;

import com.google.gwt.dom.client.Style.Unit;

public class ResizeTabLayoutPanel extends TabLayoutPanel {
    public ResizeTabLayoutPanel(double barHeight, Unit barUnit) {
        super(barHeight, barUnit);

        addSelectionHandler(new SelectionHandler<Integer>() {
            @Override
            public void onSelection(SelectionEvent<Integer> event) {
                final Widget w = getWidget(event.getSelectedItem());
                if (w instanceof RequiresResize) {
                    ((RequiresResize) w).onResize();
                }
            }
        });
    }
}


On Wed, Dec 3, 2014 at 9:19 PM, Jens <jens.nehlmeier@gmail.com> wrote:
Tabs that are not active have display:none applied which basically tells the browser "you don't have to care about that piece of HTML". So the browser will not calculate any meaningful width/height/whatever values for elements that have display:none applied and thus you can not center anything.

If I were you I would store the active rendering mode somewhere and whenever a tab gets active you use the active rendering mode to render the chess board and then center the board. TabPanel/TabLayoutPanel have add**Handler() methods for listening for tab selections.

-- J.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment