Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Combo Needs To Change To a Label
Combo Needs To Change To a Label [message #423790] Sun, 22 February 2004 15:18 Go to next message
Eclipse UserFriend
Hi!
I have a grid layout.
One of the cells has a Combo.
In response to another control's (say a Button press) event I need to
change the combo control into a Label control.
Any idea how?
I guess one can try having two controls( Combo and Labal) in same location
(smehow)and hiding and showing either.
Let me know if you have the solution?
Thanks.
Raster
Re: Combo Needs To Change To a Label [message #423792 is a reply to message #423790] Sun, 22 February 2004 16:12 Go to previous messageGo to next message
Eclipse UserFriend
"Raster" <crscca@bol.net.in> wrote in message
news:c1b2qj$t06$1@eclipse.org...
>
> I have a grid layout.
> One of the cells has a Combo.
> In response to another control's (say a Button press) event I need to
> change the combo control into a Label control.
> Any idea how?
> I guess one can try having two controls( Combo and Labal) in same location
> (smehow)and hiding and showing either.
> Let me know if you have the solution?

The solution you suggest would work fine. In the location you want both
controls to appear, place a borderless, marginless Composite widget. Then
set it layout to StackLayout, and add the two widgets, the Combo and the
Label, to the Composite. At runtime, you can then tell the Composite to show
one widget or the other.

-Eric Clayberg
Sr. Vice President of Product Development
Instantiations, Inc.
mailto:cpsws-support@instantiations.com
http://www.instantiations.com
http://www.instantiations.com/codepro/ws
http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #423798 is a reply to message #423792] Sun, 22 February 2004 22:42 Go to previous messageGo to next message
Eclipse UserFriend
I saw the link for swt-designer.
You are realeasing a trial / free edition of the swt-designer? I hope you
do that.
Raster
Eric Clayberg wrote:

> "Raster" <crscca@bol.net.in> wrote in message
> news:c1b2qj$t06$1@eclipse.org...
> >
> > I have a grid layout.
> > One of the cells has a Combo.
> > In response to another control's (say a Button press) event I need to
> > change the combo control into a Label control.
> > Any idea how?
> > I guess one can try having two controls( Combo and Labal) in same location
> > (smehow)and hiding and showing either.
> > Let me know if you have the solution?

> The solution you suggest would work fine. In the location you want both
> controls to appear, place a borderless, marginless Composite widget. Then
> set it layout to StackLayout, and add the two widgets, the Combo and the
> Label, to the Composite. At runtime, you can then tell the Composite to show
> one widget or the other.

> -Eric Clayberg
> Sr. Vice President of Product Development
> Instantiations, Inc.
> mailto:cpsws-support@instantiations.com
> http://www.instantiations.com
> http://www.instantiations.com/codepro/ws
> http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #424397 is a reply to message #423798] Mon, 23 February 2004 07:53 Go to previous messageGo to next message
Eclipse UserFriend
"Raster" <crscca@bol.net.in> wrote in message
news:c1bsqo$mft$1@eclipse.org...
>
> I saw the link for swt-designer.
> You are realeasing a trial / free edition of the swt-designer? I hope you
> do that.

A free version of SWT Designer has been available for many months now. A
trial version of SWT Designer Pro will be available soon.

-Eric Clayberg
Sr. Vice President of Product Development
Instantiations, Inc.
mailto:cpsws-support@instantiations.com
http://www.instantiations.com
http://www.instantiations.com/codepro/ws
http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #424405 is a reply to message #424397] Mon, 23 February 2004 11:26 Go to previous messageGo to next message
Eclipse UserFriend
I dont suppose you would be gifting free versions?
Eric Clayberg wrote:

> "Raster" <crscca@bol.net.in> wrote in message
> news:c1bsqo$mft$1@eclipse.org...
> >
> > I saw the link for swt-designer.
> > You are realeasing a trial / free edition of the swt-designer? I hope you
> > do that.

> A free version of SWT Designer has been available for many months now. A
> trial version of SWT Designer Pro will be available soon.

> -Eric Clayberg
> Sr. Vice President of Product Development
> Instantiations, Inc.
> mailto:cpsws-support@instantiations.com
> http://www.instantiations.com
> http://www.instantiations.com/codepro/ws
> http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #424421 is a reply to message #424405] Mon, 23 February 2004 21:39 Go to previous messageGo to next message
Eclipse UserFriend
"Raster" <crscca@bol.net.in> wrote in message
news:c1d9jo$cbk$1@eclipse.org...
>
> I dont suppose you would be gifting free versions?

"Gifting"? The free version doesn't cost anything, so feel free to download
a copy and give it to anyone you like. ;-)

-Eric Clayberg
Sr. Vice President of Product Development
Instantiations, Inc.
mailto:cpsws-support@instantiations.com
http://www.instantiations.com
http://www.instantiations.com/codepro/ws
http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #424424 is a reply to message #424421] Tue, 24 February 2004 01:26 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I meant the version for M7. (I guess I did not communicate properly)
Is it possible to get it free on a renewable trial basis.

Look me and a friend are doing some non-commercial development and could
use the designer if its free and not what it costs. If we get around to
completing what we started it would probably be GPL.

As such we are nearly done with our SWT GUIs but I suspect had we had
access to your designer we might have done it in 1 one day instead of our
three days.

If you say no sorry its not possible, thats okay the request might be
unfair on my part but no harm done in the shameless asking.

By the way what you said about the StackLayout was useful and I might have
a few more basic questions like that for later.

Thanks.
Raster

Eric Clayberg wrote:

> "Raster" <crscca@bol.net.in> wrote in message
> news:c1d9jo$cbk$1@eclipse.org...
> >
> > I dont suppose you would be gifting free versions?

> "Gifting"? The free version doesn't cost anything, so feel free to download
> a copy and give it to anyone you like. ;-)

> -Eric Clayberg
> Sr. Vice President of Product Development
> Instantiations, Inc.
> mailto:cpsws-support@instantiations.com
> http://www.instantiations.com
> http://www.instantiations.com/codepro/ws
> http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #424634 is a reply to message #424424] Tue, 24 February 2004 06:48 Go to previous messageGo to next message
Eclipse UserFriend
"Raster" <crscca@bol.net.in> wrote in message
news:c1eqqt$5rc$1@eclipse.org...
>
> I meant the version for M7. (I guess I did not communicate properly)
> Is it possible to get it free on a renewable trial basis.

You can download the free version as often as you want and grab new versions
as they become available. There is a free version for M7 available. The pro
version isn't free, however, but it does come with a year of support and
updates.

-Eric Clayberg
Sr. Vice President of Product Development
Instantiations, Inc.
mailto:cpsws-support@instantiations.com
http://www.instantiations.com
http://www.instantiations.com/codepro/ws
http://www.swt-designer.com
Re: Combo Needs To Change To a Label [message #426047 is a reply to message #423790] Mon, 01 March 2004 14:42 Go to previous message
Eclipse UserFriend
Originally posted by: micasim.gmx.de

On Sun, 22 Feb 2004 20:18:27 +0000 (UTC), Raster <crscca@bol.net.in> wrote:

> Hi!
> I have a grid layout.
> One of the cells has a Combo.
> In response to another control's (say a Button press) event I need to
> change the combo control into a Label control.
> Any idea how?
> I guess one can try having two controls( Combo and Labal) in same
> location
> (smehow)and hiding and showing either.
> Let me know if you have the solution?
> Thanks.
> Raster
>

Hi Raster,
Guess org.eclipse.swt.custom.StackLayout
is what will do the job.
Just putting the two controls in the same location doesn't work. Instead
you put a composite with an associated StackLayout where you want to put
the two widgets. Then you put the two widgets onto the Composite and
switch between them with StackLayout.setTopControl like in the example

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());

final Composite parent = new Composite(shell, SWT.NONE);
parent.setLayoutData(new GridData(GridData.FILL_BOTH));
final StackLayout layout = new StackLayout();
parent.setLayout(layout);
final Button[] bArray = new Button[10];
for (int i = 0; i < 10; i++) {
bArray[i] = new Button(parent, SWT.PUSH);
bArray[i].setText("Button "+i);
}
layout.topControl = bArray[0];

Button b = new Button(shell, SWT.PUSH);
b.setText("Show Next Button");
final int[] index = new int[1];
b.addListener(SWT.Selection, new Listener(){
public void handleEvent(Event e) {
index[0] = (index[0] + 1) % 10;
layout.topControl = bArray[index[0]];
parent.layout();
}
});

shell.open();
while (shell != null && !shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
}

Regards, michael
Previous Topic:Qeustion on hyperlink in table
Next Topic:Dictate Tree Size in a view
Goto Forum:
  


Current Time: Sat Sep 27 17:22:52 EDT 2025

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

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

Back to the top