Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsGroup Widget overlaps embedded Items
https://www.eclipse.org/forums/index.php/mv/msg/143445/451690/#msg_451690
I'm encountering a strange problem when drawing a group widget and trying to
include/embed other widgets on, those widgets do not display. Why ??
Here is a code sample:
------------------------------------------------------------ ------------------------------------------------------------ -------------------------------
/**
* @author admin
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class testGroup1
{
private static boolean internalCall;
public static void main(String[] argc)
{
Display display = new Display();
Shell shell = new Shell(display);
internalCall = true;
Label lblName = new Label(shell, SWT.NONE);
lblName.setText("Name");
GridData grid1 = new GridData();
grid1.horizontalSpan = 1;
lblName.setLayoutData(grid1);
Text text = new Text(shell, SWT.BORDER);
GridData grid2 = new GridData(GridData.FILL_HORIZONTAL);
grid2.horizontalSpan = 2;
text.setLayoutData(grid2);
Group group = new Group(shell, SWT.SHELL_TRIM);
group.setText("Group 1");
GridData grid3 = new GridData(GridData.FILL_BOTH);
grid3.horizontalSpan = 3;
group.setLayoutData(grid3);
//----------------------------------------------------------
// Next two controls (widgets) are not appearing. Why ??
//----------------------------------------------------------
Label one = new Label(group, SWT.LEFT);
one.setText("Name");
Text two = new Text(group, SWT.BORDER);
}]]>Tariq Khalaf2005-03-05T19:16:23-00:00Re: Group Widget overlaps embedded Items
https://www.eclipse.org/forums/index.php/mv/msg/143445/451701/#msg_451701
Group group = new Group(shell, SWT.SHELL_TRIM);
group.setText("Group 1");
GridData grid3 = new GridData(GridData.FILL_BOTH);
grid3.horizontalSpan = 3;
group.setLayoutData(grid3);
group.setLayout(new anyLayout());
......
"Tariq A.Khalaf" <tariqkhalaf@yahoo.com> wrote in message
news:d0d0ia$cd$1@www.eclipse.org...
> Hello,
>
> I'm encountering a strange problem when drawing a group widget and trying
to
> include/embed other widgets on, those widgets do not display. Why ??
> Here is a code sample:
> ------------------------------------------------------------ --------------
------------------------------------------------------------ ----------------
-
>
>
> import org.eclipse.swt.*;
> import org.eclipse.swt.layout.*;
> import org.eclipse.swt.widgets.*;
>
> /**
> * @author admin
> *
> * TODO To change the template for this generated type comment go to
> * Window - Preferences - Java - Code Style - Code Templates
> */
> public class testGroup1
> {
> private static boolean internalCall;
>
> public static void main(String[] argc)
> {
> Display display = new Display();
> Shell shell = new Shell(display);
> internalCall = true;
>
> GridLayout layout = new GridLayout(3, false);
>
> layout.makeColumnsEqualWidth = true;
> layout.marginHeight = 10;
> layout.marginWidth = 10;
> shell.setLayout(layout);
>
> Label lblName = new Label(shell, SWT.NONE);
> lblName.setText("Name");
>
> GridData grid1 = new GridData();
> grid1.horizontalSpan = 1;
> lblName.setLayoutData(grid1);
>
> Text text = new Text(shell, SWT.BORDER);
> GridData grid2 = new GridData(GridData.FILL_HORIZONTAL);
> grid2.horizontalSpan = 2;
> text.setLayoutData(grid2);
>
> Group group = new Group(shell, SWT.SHELL_TRIM);
> group.setText("Group 1");
>
> GridData grid3 = new GridData(GridData.FILL_BOTH);
> grid3.horizontalSpan = 3;
> group.setLayoutData(grid3);
>
> //----------------------------------------------------------
> // Next two controls (widgets) are not appearing. Why ??
> //----------------------------------------------------------
> Label one = new Label(group, SWT.LEFT);
> one.setText("Name");
> Text two = new Text(group, SWT.BORDER);
>
> shell.setSize(400, 400);
> shell.pack();
> shell.open();
> while(!shell.isDisposed()){
> if(display.readAndDispatch())
> display.sleep();
> }
>
> if(internalCall) display.dispose();
>
> }
>
> }
>
>]]>Muhammad Aamir2005-03-06T06:09:57-00:00