Sunday, July 20, 2014

Re: SplitLayoutPanel - unable to move splitters



On Sunday, July 20, 2014 1:12:32 PM UTC+2, Thomas Broyer wrote:

Every time you try to move the splitters, your onResize fires and forcefully resizes the widgets to take 25%, 50% and 25% of the available space respectively. So nothing actually resizes.

Hi Thomas,

ok, the reason for the onResize method was to initially setup the sizes.
I moved this into a new method "resetSize" so that the "onResize" method is untouched (see below).
But the splitters still cannot be moved.

Magnus

public class MasterPanel extends SplitLayoutPanel
{
 private SplitLayoutPanel pnl_n = new SplitLayoutPanel ();
 private SplitLayoutPanel pnl_c = new SplitLayoutPanel ();
 private SplitLayoutPanel pnl_s = new SplitLayoutPanel ();
 
 public MasterPanel ()
 {
  super ();
  init ();
 }

 private void init ()
 {
  pnl_n.add (new HTML ("North"));
  pnl_c.add (new HTML ("Center"));
  pnl_s.add (new HTML ("South"));
  
  addNorth (pnl_n,100);
  addSouth (pnl_s,100);
  add (pnl_c);
  
  setVisible (false);
  
  scheduleResetSize (this);
 }

 public static void scheduleResetSize (final MasterPanel pnl)
 {
  Scheduler.get().scheduleDeferred
  (
   new ScheduledCommand()
   {
    @Override
    public void execute()
    {
     pnl.resetSize ();
    }
   }
  );
 
 }
 
 public void resetSize ()
 {
  setVisible (true); // must be here

  int xs = getOffsetWidth ();
  int ys = getOffsetHeight ();
  
  int pys = (int) (ys * 0.25);
  
  //Window.alert ("pys: " + pys);

  setWidgetSize (pnl_n,pys);
  setWidgetSize (pnl_s,pys);
  
  pnl_n.setVisible (true);
  pnl_c.setVisible (true);
  pnl_s.setVisible (true);
  
 }
 
/* 
 @Override
 public void onResize ()
 {
  super.onResize ();
 }
 */
}


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment