Slick Forums
http://slick.ninjacave.com/forum/

Problems with DialogLayout
http://slick.ninjacave.com/forum/viewtopic.php?f=18&t=7007
Page 1 of 1

Author:  goui [ Tue Mar 04, 2014 2:42 pm ]
Post subject:  Problems with DialogLayout

Hello everyone,

I'm currently working on a simple widget which contains play/pause/stop buttons and a progress bar. I've successfully integrated it in an OpenGL application and it is displayed on top of a video.

I have however problems with the DialogLayout in it. I'm trying to make the progress bar take all the possible width without setting its size manually. I would like to let the layout do the job for me. Here is the sample code for my example:

Code:
...
      btnPlay = new Button();
      btnPlay.setTheme("playbutton");

      btnPause = new Button();
      btnPause.setTheme("pausebutton");
      btnPause.setEnabled(false);

      btnStop = new Button();
      btnStop.setTheme("stopbutton");

      lblBegin = new Label("0:00");
      lblBegin.setTheme("label");

      lblEnd = new Label("2:00");
      lblEnd.setTheme("label");

      bar = new ProgressBar();
      bar.setTheme("progressbar");

      videoLayout = new DialogLayout();

      Group horizontalGroup = videoLayout.createSequentialGroup();
      horizontalGroup.addWidget(btnPlay, Alignment.CENTER);
      horizontalGroup.addWidget(btnPause, Alignment.CENTER);
      horizontalGroup.addWidget(btnStop, Alignment.CENTER);
      horizontalGroup.addWidget(lblBegin, Alignment.CENTER);
      horizontalGroup.addWidget(bar, Alignment.FILL);
      horizontalGroup.addWidget(lblEnd, Alignment.CENTER);
      videoLayout.setHorizontalGroup(horizontalGroup);

      Group verticalGroup = videoLayout.createParallelGroup();
      verticalGroup.addWidget(btnPlay, Alignment.FILL);
      verticalGroup.addWidget(btnPause, Alignment.FILL);
      verticalGroup.addWidget(btnStop, Alignment.FILL);
      verticalGroup.addWidget(lblBegin, Alignment.FILL);
      verticalGroup.addGroup(videoLayout.createSequentialGroup().addGap().addWidget(bar).addGap());
      verticalGroup.addWidget(lblEnd, Alignment.FILL);
      videoLayout.setVerticalGroup(verticalGroup);

      add(videoLayout);
...


This widget is in the root panel of my GUI and I use adjustSize() methods in the layout() method of both root panel and widget.
But the sizes chosen by the layout are the min sizes. I have put in the XML the maxWidth to the MAX but it doesn't work

Does someone have a clue ?
Thank you,
Goui

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/