Results 1 to 2 of 2
- 02-11-2012, 04:23 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
Grid Layout change layout alignment of control s
I have a window with multiple composites on it. I use several of the composites as place holders that I put a second composite into and then add widgets to them. I dispose of the inner or second composite and rebuild them base on user input. The issue I have is when I rebuild the composite some times I want the controls to align to the left and other times to the right. It seems that what ever the alignment is the first time I build the composite is what I am stuck with even thought I dispose of the composite and rebuild it. I tried changing the alignment on the first (place holder) composite at the same time as the rebuilt composite but that has no effect either. Anyone have any ideas why I can't change the alignment of the composite?
Sample code
if (state.commandBtnArea != null)
state.commandBtnArea.dispose();
state.commandBtnArea = new Composite(state.reuseCommandBtnArea, SWT.LEFT);
state.commandBtnArea.setVisible(true);
GridLayout gl = new GridLayout(8, false);
gl.marginHeight = 1;
gl.marginWidth = 0;
gl.horizontalSpacing = 1;
state.commandBtnArea.setLayout(gl);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalAlignment = SWT.LEFT;
gd.verticalAlignment = SWT.CENTER;
state.reuseCommandBtnArea.setLayoutData(gd);
gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.horizontalAlignment = SWT.LEFT;
gd.verticalAlignment = SWT.CENTER;
state.commandBtnArea.setLayoutData(gd);
Thanks in advance.
RobertLast edited by rellicott; 02-11-2012 at 04:27 AM.
- 02-13-2012, 05:11 PM #2
Member
- Join Date
- Feb 2012
- Posts
- 3
- Rep Power
- 0
Re: Grid Layout change layout alignment of control s
On further review, it is not the alignment that is the problem it is the size of the recreated composite. It seems to always take the packed size of which ever composite was created first. My work around was to add some hidden field to force them to be the same size.
Robert
Similar Threads
-
Image into Grid layout
By Jaxn77 in forum AWT / SwingReplies: 6Last Post: 02-10-2011, 03:02 PM -
Group Layout Alignment
By Hades82 in forum AWT / SwingReplies: 7Last Post: 12-30-2010, 11:37 AM -
Grid layout frames GUI
By fritz1474 in forum AWT / SwingReplies: 1Last Post: 10-15-2008, 02:04 AM -
what layout to use for vertical alignment?
By dim_ath in forum AWT / SwingReplies: 6Last Post: 01-20-2008, 05:28 PM -
Help with Grid Layout
By coco in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 08:03 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks