Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » parent Composite of public FigureCanvas
parent Composite of public FigureCanvas [message #226859] Fri, 24 November 2006 15:57 Go to next message
Klaus Zerwes is currently offline Klaus ZerwesFriend
Messages: 4
Registered: July 2009
Junior Member
Hello.

If I make the Shell-Object the parent of a FigureCanvas all works well.

But if I set a regular Composite as the parent, nothing will be displayed.

I want to put my FigureCanvas insight of a sashed Composite
Are there any known Resources where I can find what kind of parent
Composites are allowed for FigureCanvas ?

code:

final Composite wsComp = new Composite(this.xShell, SWT.NO_FOCUS);
final GridData tableGD = new GridData();
tableGD.grabExcessHorizontalSpace = true;
tableGD.grabExcessVerticalSpace = true;
tableGD.verticalAlignment = GridData.FILL;
tableGD.horizontalAlignment = GridData.FILL;
wsComp.setLayoutData(tableGD);
final FormLayout formLayOut = new FormLayout ();
wsComp.setLayout(formLayOut);
final Sash sash = new Sash (wsComp, SWT.VERTICAL);
final int limit = 20, percent = 15;
final FormData sashData = new FormData ();
sashData.left = new FormAttachment (percent, 0);
sashData.top = new FormAttachment (0, 0);
sashData.bottom = new FormAttachment (100, 0);
sash.setLayoutData (sashData);
sash.addListener (...);

on the left side I add a Canvas and a LightweightSystem, drawing some
figures - this works!
new Canvas(wsComp,SWT.BORDER); ...

On the right side of the sash i want to add a FigureCanvas.
I tried some Composite-Objects (Composit, Canvas, Group, ...), but the
FigureCanvas will not show up.
If I set the shell as the parent, FigureCanvas is showing up - at the
wrong place of course below the sash


Any hints on how to fix this are welcome.
Thank you in advance

PS: sorry for my english :-(

Klaus
Re: parent Composite of public FigureCanvas [message #226868 is a reply to message #226859] Fri, 24 November 2006 19:41 Go to previous message
Klaus Zerwes is currently offline Klaus ZerwesFriend
Messages: 4
Registered: July 2009
Junior Member
Klaus Zerwes schrieb:
> Hello.
>
> If I make the Shell-Object the parent of a FigureCanvas all works well.

OK - help your self the god will help you ...
Heres a solution for the archive

> But if I set a regular Composite as the parent, nothing will be displayed.
>
> I want to put my FigureCanvas insight of a sashed Composite
> Are there any known Resources where I can find what kind of parent
> Composites are allowed for FigureCanvas ?
>
> code:
>
> final Composite wsComp = new Composite(this.xShell, SWT.NO_FOCUS);
> final GridData tableGD = new GridData();
> tableGD.grabExcessHorizontalSpace = true;
> tableGD.grabExcessVerticalSpace = true;
> tableGD.verticalAlignment = GridData.FILL;
> tableGD.horizontalAlignment = GridData.FILL;
> wsComp.setLayoutData(tableGD);
> final FormLayout formLayOut = new FormLayout ();
> wsComp.setLayout(formLayOut);
> final Sash sash = new Sash (wsComp, SWT.VERTICAL);
> final int limit = 20, percent = 15;
> final FormData sashData = new FormData ();
> sashData.left = new FormAttachment (percent, 0);
> sashData.top = new FormAttachment (0, 0);
> sashData.bottom = new FormAttachment (100, 0);
> sash.setLayoutData (sashData);
> sash.addListener (...);

before you add the FigureCanvas, create a parent composit for the layout
like:
final Composite fcComp = new Composite(wsComp,SWT.BORDER);
FormData fcWSData = new FormData();
fcWSData.left = new FormAttachment(sash, 0);
fcWSData.right = new FormAttachment(100, 0);
fcWSData.top = new FormAttachment(0, 0);
fcWSData.bottom = new FormAttachment(100, 0);
fcComp.setLayoutData(fcWSData);
GridLayout gridLayoutC = new GridLayout();
gridLayoutC.horizontalSpacing = 0;
gridLayoutC.verticalSpacing = 0;
fcComp.setLayout(gridLayoutC);

and use it (here fcComp) as Composite for the FigureCanvas.

> on the left side I add a Canvas and a LightweightSystem, drawing some
> figures - this works!
> new Canvas(wsComp,SWT.BORDER); ...
>
> On the right side of the sash i want to add a FigureCanvas.
> I tried some Composite-Objects (Composit, Canvas, Group, ...), but the
> FigureCanvas will not show up.
> If I set the shell as the parent, FigureCanvas is showing up - at the
> wrong place of course below the sash
>
>
> Any hints on how to fix this are welcome.
> Thank you in advance
>
> PS: sorry for my english :-(
>
> Klaus

wish you all a nice weekend
Klaus
Previous Topic:XYLayout problem.
Next Topic:cannot capture mouse double click event
Goto Forum:
  


Current Time: Tue Apr 23 14:18:34 GMT 2024

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

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

Back to the top