Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] ordering problem adding buttons to a GridLayout


1) Post Code
2) Don't use setParent() - it doesn't work on every platform.  Just pass in the parent.
3) Use moveAbove() to change the Z-order to be the order you want or reverse the calls to setParent().

> other than the aforementioned Shell as the parent argument to its
> constructor. (something that unfortunately has to be done because SWT
> widgets have no default constructor).  After creating the buttons, I set


Why does this have to be done?



"Brad O'Hearne" <brado@xxxxxxxxxxxxx>
Sent by: platform-swt-dev-admin@xxxxxxxxxxx

10/21/2003 01:06 PM
Please respond to platform-swt-dev

       
        To:        "SWT-Dev" <platform-swt-dev@xxxxxxxxxxx>
        cc:        
        Subject:        [platform-swt-dev] ordering problem adding buttons to a GridLayout



I have a weird layout problem that I cannot quite figure out.  I am creating
a simple Shell s that has a GridLayout with 2 columns.  I am then creating 2
buttons, b1 and b2.  However, when I create those buttons, I use a Composite
other than the aforementioned Shell as the parent argument to its
constructor. (something that unfortunately has to be done because SWT
widgets have no default constructor).  After creating the buttons, I set
their layout data (which is nothing more than a GridData object with
GridData.FILL_BOTH).  I then invoke the setParent(s); method on both b1 and
b2 to make s the parent, and then open the Shell.

Here's the weird thing: b1, which was added first to the Shell (s), displays
on the right, while b2 displays on the left.  The doc says that components
in a GridLayout are laid out from left to right, but this would suggest
right to left.  Any ideas on the problem?

BradO

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top