What does setWidth ("*") do in CSS / SmartGWT?

I came across some outdated code that uses SmartGWT. I suspect the API is present in the standard GWT as well.

widget.setWidth("*"); 

Bearing in mind that the same bit of code has:

 otherWidget.setWidth100(); 

I do not know that CSS has something like:

 width: *; 

So ... this code is legal, and if so, what does it do ... or not ?!

Thanks in advance.

+4
source share
2 answers

SmartGWT .setWidth("*") uses rest of available width. For example, if you have an HPanel with two children, and one of the children has setWidth("10%") , then implicitly the child with setWidth("*" ) will have a width of 90%. This allows you to change the width of one child without having to update another setWidth call.

+6
source

Please note that you have a Panel with two children. Now, if you set setWidth("*") for both descendants, then the first child will accept the required width, and the second will receive all that remains.

If you set setWidth("60%") for the first child and setWidth("*") for the second child, then the first child will take 60% of the panel width, and the second child will receive the remaining 40%.

.setWidth100(); and .setHeight100(); these 2 cause the component to fill the canvas in which it is located. This is the average width and height of 100%, which is equivalent to setWidth("100%") and setHeight("100%") respectively.

This is usually used when you specifically do not want to set the width of the child panel. You specify the coarse width of the first child panel and automatically set the width of the second child.

+2
source

Source: https://habr.com/ru/post/1335157/


All Articles