Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to set a composite which is layouted by GridLayout totally invisible?
How to set a composite which is layouted by GridLayout totally invisible? [message #1715191] Fri, 20 November 2015 01:29 Go to next message
Eclipse UserFriend
As I know, set a composite which is layouted by GridLayout invisible will
make it invisible but still occupied it's origin place.
I don't like it still occupied it's place, I want it totally invisible,
which means other composites will take it place.

How to?

Thanks.

frank.
Re: How to set a composite which is layouted by GridLayout totally invisible? [message #1715507 is a reply to message #1715191] Tue, 24 November 2015 08:16 Go to previous messageGo to next message
Niraj Modi is currently offline Niraj ModiFriend
Messages: 47
Registered: November 2013
Member
Try making a Control transparent using below method call:
composite.setBackground(display.getSystemColor(SWT.COLOR_TRANSPARENT));

Refer usage of SWT.COLOR_TRANSPARENT in below example:
http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java
Re: How to set a composite which is layouted by GridLayout totally invisible? [message #1718194 is a reply to message #1715507] Mon, 21 December 2015 08:34 Go to previous message
Eclipse UserFriend
Hi,

You misunderstand what I mean.

There are two (a, b) composites put on a base (A) composite and set the
composite a to fill horizontal and composite b to fill both.
If I set composite a to be invisible and call layout() of A, you will find
composite a to be invisible, however, it still occupied the space.
The composite b does not really fill all the space of the A composite. But I
want it (this means b) to do so, since composite a is invisible and it (this
means a) should not occupied it's space anymore.

After tracing the source code of GridLayout in SWT, I found it use
composite.getChildren() to get all children.
So I copy the source code of GridLayout and GridData to my named space, and
modified it to get visible children only, finally it solved my problem.

Why SWT get all children of composite to layout?
Why doesn't it take off the invisible ones?

Any other ways to solve my problem instead of copy classes to my named space
and modify the source code?

thanks.

Frank, using SWT 4604

"Niraj Modi" <forums-noreply@xxxxxxxx> 写入消息
news:n316cv$2i2$1@xxxxxxxxe.org...
> Try making a Control transparent using below method call:
> composite.setBackground(display.getSystemColor(SWT.COLOR_TRANSPARENT));
>
> Refer usage of SWT.COLOR_TRANSPARENT in below example:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet365.java
Previous Topic:no swt-cocoa-4233.dll in java
Next Topic:SWT function Browser.setCookie doesn't work in IE
Goto Forum:
  


Current Time: Tue Dec 12 10:42:23 GMT 2017

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

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