Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Strange Composite.pack(true) behavior in e4
Strange Composite.pack(true) behavior in e4 [message #885080] Tue, 12 June 2012 12:31
Mauro Condarelli is currently offline Mauro CondarelliFriend
Messages: 428
Registered: September 2009
Senior Member
I have the following code (abridged):

parent.setLayout(new GridLayout(1, false));

cmpHeader = new Composite(parent, SWT.NONE);
GridLayout gl_cmpHeader = new GridLayout(9, false);
gl_cmpHeader.verticalSpacing = 0;
gl_cmpHeader.marginWidth = 0;
gl_cmpHeader.marginHeight = 0;
cmpHeader.setLayout(gl_cmpHeader);
cmpHeader.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

Button btnSPrev = new Button(cmpHeader, SWT.NONE);
btnSPrev.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnSPrev.setText("SPrev");
btnSPrev.addSelectionListener(new SelectionAdapter() {...});

Button btnPrev = new Button(cmpHeader, SWT.NONE);
btnPrev.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnPrev.setText("Prev");
btnPrev.addSelectionListener(new SelectionAdapter() {...});

Label lblNewLabel = new Label(cmpHeader, SWT.NONE);
lblNewLabel.setEnabled(false);
lblNewLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

lblBook = new Label(cmpHeader, SWT.BORDER);
lblBook.setText("Book");
lblBook.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));

lblChapter = new Label(cmpHeader, SWT.BORDER);
lblChapter.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
lblChapter.setText("Chapter");

lblScene = new Label(cmpHeader, SWT.BORDER);
lblScene.setText("Scene");

Label lblNewLabel_1 = new Label(cmpHeader, SWT.NONE);
lblNewLabel_1.setEnabled(false);
lblNewLabel_1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

Button btnNext = new Button(cmpHeader, SWT.NONE);
btnNext.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnNext.setText("Next");
btnNext.addSelectionListener(new SelectionAdapter() {...});

Button btnSNext = new Button(cmpHeader, SWT.NONE);
btnSNext.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnSNext.setText("SNext");
btnSNext.addSelectionListener(new SelectionAdapter() {...});

Composite composite_1 = new Composite(parent, SWT.NONE);
...
and later:
...
lblScene.setText(scene.getTitle());
lblChapter.setText(scene.getChapter().getTitle());
lblBook.setText(scene.getChapter().getBook().getTitle());
cmpHeader.pack(true);
...

Immediately after "cmpHeader.pack(true);" I have the header resized to minimum (ignoring SWT.FILL) as in the first image.
If I resize the window everything snaps back to normal (see second image).

What am I doing wrong?

Regards
Mauro
  • Attachment: 1.jpg
    (Size: 48.15KB, Downloaded 198 times)
  • Attachment: 2.jpg
    (Size: 50.35KB, Downloaded 199 times)
Previous Topic:Copy multiple images to the clipboard
Next Topic:Strange Composite.pack(true) behavior in e4
Goto Forum:
  


Current Time: Thu Apr 25 01:08:23 GMT 2024

Powered by FUDForum. Page generated in 0.02849 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top