Stacklayout issue in designer

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Stacklayout issue in designer

Postby kgregg » Fri Aug 20, 2010 6:43 am

I have a stacklayout defined with a button on one layer and a label on another layer. Design view doesn't recognize it as a stacklayout - just displays the layer with the button. If I select the whole shell in design I don't get the small up/down arrows to let me switch between layers. If I click on the label then the button in the components, I see their properties but the design view doesn't change - stays as the button. At runtime, it works fine - I have a listener defined on the button click to switch to the other layer. It worked as expected at initial setup, but broke sometime later, probably about the time I setup the listener to switch layers. Is it likely that my code is confusing designer and it only knows about the single layer?
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: Stacklayout issue in designer

Postby Eric Clayberg » Fri Aug 20, 2010 8:09 am

Please post a test case showing exactly what you are doing.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Stacklayout issue in designer

Postby kgregg » Fri Aug 20, 2010 9:01 am

Code defines a label and a button, then a stacklayout and assigns topControl to the label. In designer, button shows and I can't get the label to show. At runtime, button shows as expected, then label shows when button is clicked as it should. (Button's image is a use agreement that they have to click thru to see the label, which is a logo.) Before I added the listener to the button, designer allowed me to select widgets and they would display and also gave me the up/down arrows in the shell display to change layers. Now, even if I comment the listener code, I still can't see the label in designer and it doesn't show the up/down layer select arrows.

Code: Select all
final StackLayout layout;
shlHello = new Shell();
final Label label = new Label(shlHello, SWT.NONE);
label.setImage(SWTResourceManager.getImage(StartupMenu.class, "LogoLarge.jpg"));
label.setAlignment(SWT.CENTER);
final Button btnok = new Button(shlHello, SWT.NONE);
btnok.setToolTipText("Please click the button to continue.");
btnok.setImage(SWTResourceManager.getImage(StartupMenu.class, "Agreement1.JPG"));
btnok.setLocation(0, 0);
btnok.setSize(752, 305);
btnok.addSelectionListener(new SelectionAdapter() {
   @Override
   public void widgetSelected(SelectionEvent e) {
   layout.topControl = label;
   shlHello.layout();
   }
});
shlHello.setSize(760, 352);
shlHello.setText("Hello");
layout = new StackLayout();
shlHello.setLayout( layout );
layout.topControl = btnok;
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: Stacklayout issue in designer

Postby Eric Clayberg » Mon Aug 23, 2010 12:34 pm

The current parser likes the following...

Code: Select all
       Shell shlHello = new Shell();
       final StackLayout layout = new StackLayout();
       shlHello.setLayout( layout );

...but does not like this...

Code: Select all
       final StackLayout layout;
       ...
       Shell shlHello = new Shell();
       layout = new StackLayout();
       shlHello.setLayout( layout );

We have this fixed for the latest build. If you have a support contract, we can provide you with access to that now.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Re: Stacklayout issue in designer

Postby kgregg » Fri Aug 27, 2010 10:37 am

No support contract - we're caught in the never-never land between Instantiations and Google!
kgregg
 
Posts: 14
Joined: Thu Aug 19, 2010 9:22 am

Re: Stacklayout issue in designer

Postby Eric Clayberg » Fri Aug 27, 2010 11:03 am

kgregg wrote:No support contract - we're caught in the never-never land between Instantiations and Google!

In that case, I would recommend changing the code to match the first pattern above.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to SWT Designer

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

cron