Tuesday, August 28, 2012

How to size a widget for optimal presentation?

Hello,

I have a Widget "SelectionField", which extends Composite and contains a label and a button, within a HorizontalPanel.

The label should always occupy all the horizontal space that is available besides the button.

I tried to set its width to "100%". I also tried around with RequiresResize and onResize, but nothing worked.

How would you do this?

Thanks
Magnus

-----


public class SelectionField extends Composite implements
{
 private HorizontalPanel pnl = new HorizontalPanel ();
 private Label           lbl_Tournament = new Label ();
 private PushButton      btn_Select = new PushButton (">");
 
 public SelectionField()
 {
  super ();
 
  initWidget (pnl);

  pnl.setBorderWidth(1);
  pnl.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
 
  pnl.add (lbl_Tournament);
  pnl.add (btn_Select);

  lbl_Tournament.setWidth("200px");
 }
}

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-web-toolkit/-/hKKAiGOddfIJ.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment