Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT custom widgets height

Tags:

height

gwt

I need a custom widget height. I tried using this

Integer.toString(yourWidget.getElement().getOffsetHeight())

but,

  • If I use it when I create it or add it to the container panel, it returns 0
  • If I use it in the contrainer panel's onLoad method, it returns the widget height before the style is applied

So, when should I use it to get the widget height after the style is applied?

Thanks a lot!

like image 846
david Avatar asked Nov 15 '22 09:11

david


1 Answers

I don't known if you've solved your problem already, but an option to use JSNI would be making sure that the widget creation is finished.

A way of achieving that is with the Deferred command:

    DeferredCommand.addCommand(new Command() {
        public void execute() {
            // Ask here for the height
        }
    });
like image 55
Carlos Tasada Avatar answered Feb 15 '23 19:02

Carlos Tasada