Transparent Canvas inside a composite parent [message #1768778] |
Sun, 23 July 2017 19:48 ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Hello all,
I am using Nebula visualization widgets in my projects. The widgets are created on top of a canvas. The canvas sits on the top of a composite parent.
The problem i face is that, the canvas can be clearly differentiated from the underlying composite parent. I want to make them indifferentiable.
The Code I am using :
Composite comp = new Composite(folder, SWT.None);
GridLayout layout = new GridLayout();
layout.numColumns = 4;
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
comp.setLayout(layout);
// creating canvases to hold the widgets.
Canvas knobCanvas = new Canvas(comp, SWT.BORDER);
knobCanvas.setLayoutData(gd);
Canvas gaugeCanvas = new Canvas(comp, SWT.BORDER);
gaugeCanvas.setLayoutData(gd);
Canvas thermoCanvas = new Canvas(comp, SWT.BORDER);
thermoCanvas.setLayoutData(gd);
Canvas tankCanvas = new Canvas(comp, SWT.BORDER);
tankCanvas.setLayoutData(gd);
Canvas knobCanvas1 = new Canvas(comp, SWT.BORDER);
knobCanvas1.setLayoutData(gd);
// use LightweightSystem to create the bridge between SWT and draw2D
LightweightSystem lws = new LightweightSystem(knobCanvas);
// Create widgets
final KnobFigure knobFigure = new KnobFigure();
lws.setContents(knobFigure);
lws = new LightweightSystem(gaugeCanvas);
final GaugeFigure gauge = new GaugeFigure();
gauge.setBackgroundColor(XYGraphMediaFactory.getInstance().getColor(0, 0, 0));
gauge.setForegroundColor(XYGraphMediaFactory.getInstance().getColor(255, 255, 255));
lws.setContents(gauge);
lws = new LightweightSystem(thermoCanvas);
final ThermometerFigure thermo = new ThermometerFigure();
lws.setContents(thermo);
lws = new LightweightSystem(tankCanvas);
final TankFigure tank = new TankFigure();
lws.setContents(tank);
lws = new LightweightSystem(knobCanvas1);
final KnobFigure knobFigure1 = new KnobFigure();
lws.setContents(knobFigure1);
I have tried many methods, but none of them work unfortunately. Please see the attached Pic for the reference. What I am trying to do is remove the clearly visible canvas and make them match with the background. Is there any method to make the the canvas transparent? Any help will be appreciated !
Regards,
Sudharshan
|
|
|
|
Re: Transparent Canvas inside a composite parent [message #1769124 is a reply to message #1768817] |
Wed, 26 July 2017 20:30 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Eclipse User![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=) |
|
|
|
Hello Wim,
The reason I used a canvas was because, I had to work with a composite parent. In the examples snippets, they use a shell and associate the LightweightSystem with the shell. Whereas In my case, If I use a shell, I wont be able to connect to my composite. Hence I used the canvas. Please let me know if there are any other alternatives where I can use my widgets through a composite parent.
Thank you for your time.
Regards,
Sudharshan
|
|
|
|
Powered by
FUDForum. Page generated in 0.02621 seconds