Hello,
 
I have changed the composite widget to use just HTML/CSS, but the label is 
not visible (size 0) after adding the composite widgetto a LayoutPanel. In 
addition I have to hard code the height of the widget, without knowing how 
much height a button and a lable need in the different browsers...
 
See the simplified code for the composite widget (TournamentField), and 
also the code for the surrounding layout (OverallLayout) (which is not a 
real world example but shows how the TournamentField is inserted).
 
I believe that the inner widget would work, if it wasn't placed into a 
LayoutPanel...
 
Magnus
 
--
 
public class TournamentField extends Composite
{
  private FlowPanel     pnl = new FlowPanel ();
  private Label         lbl_Tournament = new Label ();
  private PushButton    btn_Select = new PushButton (">");
  private static final int XS_BTN = 15;
  
 
 public TournamentField ()
 {
  super ();
  init ();
 }
  
 private void init ()
 {
  initWidget (pnl);
  pnl.add (lbl_Tournament);
  pnl.add (btn_Select);
  
  btn_Select.getElement().getStyle().setFloat(Style.Float.RIGHT);
  btn_Select.setWidth(XS_BTN + "px");
  lbl_Tournament.getElement().getStyle().setMarginRight(XS_BTN + 5,Unit.PX);
 }
}
 
---

public class OverallLayout extends Composite implements RequiresResize
{
 private LayoutPanel     pnl = new LayoutPanel ();
 private TournamentField fld_Tournament = new TournamentField ();
 private static final int YS_FLD = 25;
 
 public OverallLayout ()
 {
  super ();
  init ();
 }
 
 private void init ()
 {
  initWidget (pnl);
  pnl.add (fld_Tournament);
  pnl.setWidgetHorizontalPosition(fld_Tournament, Layout.Alignment.END);
 }
 @Override
 public void onResize()
 {
  Size sp = gui.getSize (pnl); // calls getOffsetWidth/Height
  
  int d = (sp.y - YS_FLD) / 2;
  int xs = some_value;
  pnl.setWidgetRightWidth (fld_Tournament,0,Unit.PX,xs,Unit.PX);
  pnl.setWidgetTopHeight  (fld_Tournament,d,Unit.PX,FLD_YS,Unit.PX);
 }
}
 

-- 
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/-/s23JKi9Z31QJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to