In pure HTML I would do it like:

http://jsfiddle.net/EHCGu/

you can drag the vertical splitter to change the size of the result and the 
label <div> fills all the space while the button is float:right. No need to 
use any onResize() JavaScript as the browser takes care of the size. Maybe 
you can omit the  div that clears the float:right.

You should use as much CSS as you can, so you don't have to worry about 
resizing your widgets. Let the browser do it. 

-- J.


Am Montag, 3. September 2012 16:16:05 UTC+2 schrieb Magnus:
>
>
> Am Montag, 3. September 2012 14:08:27 UTC+2 schrieb Andrei: 
>>
>> Maybe if you can give a specific example of a problem you face, we can 
>> suggest a solution.
>>
>> Hello,
>  
> I actually need a composite panel "TournamentField" that consists of two 
> widgets, a label and a button at the right of the label. I want that the 
> label always consumes most available horizontal space, while the button has 
> a fixed size.
>  
> [ label with variable width][button]
>  
> Below is the code.
> (The HorizontalLayoutPanel is just a FlowPanel which sets "float:left;" on 
> its children, as supposed by the article "Moving to standards mode" in the 
> GWT docs.
>  
> As you can see, I even needed to use a hard coded size for the height of 
> the label, because I do not know the default height...
>  
> This TournamentField is added to a LayoutPanel.
>  
> Magnus
>  
> -----
>  
> package bcs.client.mod.tournament.cmp;
>  
> ...
>  
> public class TournamentField extends Composite implements RequiresResize
> {
>  private HorizontalLayoutPanel     pnl = new HorizontalLayoutPanel ();
>  private Label                     lbl_Tournament = new Label ();
>  private PushButton                btn_Select = new PushButton (">");
>  private static final int XS_BTN = 15;
>  private static final int YS = 25;
>  
>  public TournamentField ()
>  {
>   super ();
>   init ();
>  }
>  
>  private void init ()
>  {
>   initWidget (pnl);
>   pnl.add (lbl_Tournament);
>   pnl.add (btn_Select);
>   gui.styleBorder(lbl_Tournament,"#FF55DD");
>  }
>  
>  @Override
>  public void onResize()
>  {
>   Size sp = gui.getSize(pnl); // size contains two ints: x and y
>   
>   btn_Select.setWidth(XS_BTN + "px");
>   
>   int lxs = sp.x - XS_BTN - 15;
>   
>   if (lxs < 0)
>    lxs = 0;
>   
>   lbl_Tournament.setWidth(lxs + "px");
>   lbl_Tournament.setHeight(sp.y + "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/-/mfRKWSgjKOcJ.
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