Slick Forums

Discuss the Slick 2D Library
It is currently Mon Jul 23, 2018 7:47 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Tue Mar 04, 2014 2:42 pm 
Offline

Joined: Thu Feb 27, 2014 2:22 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group