Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SashForm works, Composite does not?
SashForm works, Composite does not? [message #432779] Fri, 26 March 2004 03:52 Go to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

Hi!

IŽm creating a simple view with a table and a few buttons in it.

The problem is: if I create a SashForm and give it as a parent for my
components, everything is ok. But if I create a Composite as a parent for
my components, nothing is drawn on my view, i.e. it is empty!! WhyŽs
that?? I really donŽt need the SashForm, because I would like the screen
to be divided statically, so what do I have to do to make components
visible in Composite??
Re: SashForm works, Composite does not? [message #432780 is a reply to message #432779] Fri, 26 March 2004 05:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: thomas_maeder.ch.ibm.com

You guess you don't have a layout on the composite, or you might be
missing the correct layout data on the children.

Thomas

Purjo wrote:

> Hi!
>
> IŽm creating a simple view with a table and a few buttons in it.
>
> The problem is: if I create a SashForm and give it as a parent for my
> components, everything is ok. But if I create a Composite as a parent for
> my components, nothing is drawn on my view, i.e. it is empty!! WhyŽs
> that?? I really donŽt need the SashForm, because I would like the screen
> to be divided statically, so what do I have to do to make components
> visible in Composite??
>
Re: SashForm works, Composite does not? [message #432781 is a reply to message #432780] Fri, 26 March 2004 05:57 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

Do I always have to define some layout for the Composite? DoesnŽt it use a
default layout if I donŽt define any? Ans what do you mean with 'layout
data on the children'?? Could you please give me some example code to
solve this issue....

Thomas Mäder wrote:

> You guess you don't have a layout on the composite, or you might be
> missing the correct layout data on the children.

> Thomas

> Purjo wrote:

> > Hi!
> >
> > IŽm creating a simple view with a table and a few buttons in it.
> >
> > The problem is: if I create a SashForm and give it as a parent for my
> > components, everything is ok. But if I create a Composite as a parent for
> > my components, nothing is drawn on my view, i.e. it is empty!! WhyŽs
> > that?? I really donŽt need the SashForm, because I would like the screen
> > to be divided statically, so what do I have to do to make components
> > visible in Composite??
> >
Re: SashForm works, Composite does not? [message #432788 is a reply to message #432781] Fri, 26 March 2004 09:28 Go to previous messageGo to next message
Eclipse UserFriend
The best way to learn SWT is study the snippets:

http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/dev.html#snippets

"Purjo" <purjo76@luukku.com> wrote in message
news:c412bi$csk$1@eclipse.org...
> Do I always have to define some layout for the Composite? Doesn
Re: SashForm works, Composite does not? [message #432820 is a reply to message #432779] Sun, 28 March 2004 15:45 Go to previous messageGo to next message
Eclipse UserFriend
I hate to break it to you, but it's not just your layout manager that's
messed up. You'll have this problem even after you set up your layout
manager and layout data correctly. The solution is to call the
Composite.layout() method when you open your shell. Incidentally, even
SashForm doesn't work on Win XP if you contain it in a Composite, while
it works on GTK. I'm still trying to find a work around for TabForm,
which displays itself, but not it's children.

Daniel

Purjo wrote:

>Hi!
>
>IŽm creating a simple view with a table and a few buttons in it.
>
>The problem is: if I create a SashForm and give it as a parent for my
>components, everything is ok. But if I create a Composite as a parent for
>my components, nothing is drawn on my view, i.e. it is empty!! WhyŽs
>that?? I really donŽt need the SashForm, because I would like the screen
>to be divided statically, so what do I have to do to make components
>visible in Composite??
>
>
>
Re: SashForm works, Composite does not? [message #432873 is a reply to message #432820] Tue, 30 March 2004 09:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

Thanks for your answer Daniel.

Anyway, calling that layout() method did not help at all, still my
Composite is empty? Any other ideas how to fix this problem??

This is what I am doing now:

Composite composite = new Composite(parent, SWT.HORIZONTAL);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final StackLayout layout = new StackLayout();
composite.setLayout(layout);
createUI(); //method that draws other components on composite
this.setControl(composite);
sash.layout();


Daniel Spiewak wrote:

> I hate to break it to you, but it's not just your layout manager that's
> messed up. You'll have this problem even after you set up your layout
> manager and layout data correctly. The solution is to call the
> Composite.layout() method when you open your shell. Incidentally, even
> SashForm doesn't work on Win XP if you contain it in a Composite, while
> it works on GTK. I'm still trying to find a work around for TabForm,
> which displays itself, but not it's children.

> Daniel

> Purjo wrote:

> >Hi!
> >
> >IŽm creating a simple view with a table and a few buttons in it.
> >
> >The problem is: if I create a SashForm and give it as a parent for my
> >components, everything is ok. But if I create a Composite as a parent for
> >my components, nothing is drawn on my view, i.e. it is empty!! WhyŽs
> >that?? I really donŽt need the SashForm, because I would like the screen
> >to be divided statically, so what do I have to do to make components
> >visible in Composite??
> >
> >
> >
Re: SashForm works, Composite does not? [message #432998 is a reply to message #432873] Wed, 31 March 2004 06:24 Go to previous messageGo to next message
Eclipse UserFriend
Hi Purjo,

did you set the top control of your StackLayout? E.g.

layout.topControl = composite;

Can you provide a snippet?

Ralf

Purjo schrieb:
> Thanks for your answer Daniel.
>
> Anyway, calling that layout() method did not help at all, still my
> Composite is empty? Any other ideas how to fix this problem??
>
> This is what I am doing now:
>
> Composite composite = new Composite(parent, SWT.HORIZONTAL);
> composite.setLayoutData(new GridData(GridData.FILL_BOTH));
> final StackLayout layout = new StackLayout();
> composite.setLayout(layout);
> createUI(); //method that draws other components on composite
> this.setControl(composite);
> sash.layout();
>
>
> Daniel Spiewak wrote:
>
>
>>I hate to break it to you, but it's not just your layout manager that's
>>messed up. You'll have this problem even after you set up your layout
>>manager and layout data correctly. The solution is to call the
>>Composite.layout() method when you open your shell. Incidentally, even
>>SashForm doesn't work on Win XP if you contain it in a Composite, while
>>it works on GTK. I'm still trying to find a work around for TabForm,
>>which displays itself, but not it's children.
>
>
>>Daniel
Re: SashForm works, Composite does not? [message #433137 is a reply to message #432998] Fri, 02 April 2004 02:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

I also tried that, without any effect. How can this be made so difficult??
I mean, it really doesnŽt give a good picture of SWT if itŽs so hard to
get even few components drawn to the screen?? Why canŽt I just add a
component inside another like in Swing, and they are shown ok??

Could someone PLEASE show me how to draw two tables inside CTabFolder
without using SashForm??

Ralf Koban wrote:

> Hi Purjo,

> did you set the top control of your StackLayout? E.g.

> layout.topControl = composite;

> Can you provide a snippet?

> Ralf

> Purjo schrieb:
> > Thanks for your answer Daniel.
> >
> > Anyway, calling that layout() method did not help at all, still my
> > Composite is empty? Any other ideas how to fix this problem??
> >
> > This is what I am doing now:
> >
> > Composite composite = new Composite(parent, SWT.HORIZONTAL);
> > composite.setLayoutData(new GridData(GridData.FILL_BOTH));
> > final StackLayout layout = new StackLayout();
> > composite.setLayout(layout);
> > createUI(); //method that draws other components on composite
> > this.setControl(composite);
> > sash.layout();
> >
> >
> > Daniel Spiewak wrote:
> >
> >
> >>I hate to break it to you, but it's not just your layout manager that's
> >>messed up. You'll have this problem even after you set up your layout
> >>manager and layout data correctly. The solution is to call the
> >>Composite.layout() method when you open your shell. Incidentally, even
> >>SashForm doesn't work on Win XP if you contain it in a Composite, while
> >>it works on GTK. I'm still trying to find a work around for TabForm,
> >>which displays itself, but not it's children.
> >
> >
> >>Daniel
Re: SashForm works, Composite does not? [message #433139 is a reply to message #433137] Fri, 02 April 2004 03:05 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

A little correction: inside CTabItem, of course. I have a ViewPart that
has CTabFolder, and there are three CTabItems in it. But I just canŽt get
anything drawn on those:=(

Purjo wrote:

> I also tried that, without any effect. How can this be made so difficult??
> I mean, it really doesnŽt give a good picture of SWT if itŽs so hard to
> get even few components drawn to the screen?? Why canŽt I just add a
> component inside another like in Swing, and they are shown ok??

> Could someone PLEASE show me how to draw two tables inside CTabFolder
> without using SashForm??

> Ralf Koban wrote:

> > Hi Purjo,

> > did you set the top control of your StackLayout? E.g.

> > layout.topControl = composite;

> > Can you provide a snippet?

> > Ralf

> > Purjo schrieb:
> > > Thanks for your answer Daniel.
> > >
> > > Anyway, calling that layout() method did not help at all, still my
> > > Composite is empty? Any other ideas how to fix this problem??
> > >
> > > This is what I am doing now:
> > >
> > > Composite composite = new Composite(parent, SWT.HORIZONTAL);
> > > composite.setLayoutData(new GridData(GridData.FILL_BOTH));
> > > final StackLayout layout = new StackLayout();
> > > composite.setLayout(layout);
> > > createUI(); //method that draws other components on composite
> > > this.setControl(composite);
> > > sash.layout();
> > >
> > >
> > > Daniel Spiewak wrote:
> > >
> > >
> > >>I hate to break it to you, but it's not just your layout manager that's
> > >>messed up. You'll have this problem even after you set up your layout
> > >>manager and layout data correctly. The solution is to call the
> > >>Composite.layout() method when you open your shell. Incidentally, even
> > >>SashForm doesn't work on Win XP if you contain it in a Composite, while
> > >>it works on GTK. I'm still trying to find a work around for TabForm,
> > >>which displays itself, but not it's children.
> > >
> > >
> > >>Daniel
Re: SashForm works, Composite does not? [message #433150 is a reply to message #433139] Fri, 02 April 2004 07:18 Go to previous messageGo to next message
Eclipse UserFriend
Hi Purjo,

Please provide a snippet.

Thanks
Ralf

Purjo schrieb:
> A little correction: inside CTabItem, of course. I have a ViewPart that
> has CTabFolder, and there are three CTabItems in it. But I just canŽt get
> anything drawn on those:=(
>
> Purjo wrote:
>
>
>>I also tried that, without any effect. How can this be made so difficult??
>>I mean, it really doesnŽt give a good picture of SWT if itŽs so hard to
>>get even few components drawn to the screen?? Why canŽt I just add a
>>component inside another like in Swing, and they are shown ok??
>
>
>>Could someone PLEASE show me how to draw two tables inside CTabFolder
>>without using SashForm??
>
>
>>Ralf Koban wrote:
>
>
>>>Hi Purjo,
>
>
>>>did you set the top control of your StackLayout? E.g.
>
>
>>>layout.topControl = composite;
>
>
>>>Can you provide a snippet?
>
>
>>>Ralf
>
>
>>>Purjo schrieb:
>>>
>>>>Thanks for your answer Daniel.
>>>>
>>>>Anyway, calling that layout() method did not help at all, still my
>>>>Composite is empty? Any other ideas how to fix this problem??
>>>>
>>>>This is what I am doing now:
>>>>
>>>> Composite composite = new Composite(parent, SWT.HORIZONTAL);
>>>> composite.setLayoutData(new GridData(GridData.FILL_BOTH));
>>>> final StackLayout layout = new StackLayout();
>>>> composite.setLayout(layout);
>>>> createUI(); //method that draws other components on composite
>>>> this.setControl(composite);
>>>> sash.layout();
>>>>
>>>>
>>>>Daniel Spiewak wrote:
>>>>
>>>>
>>>>
>>>>>I hate to break it to you, but it's not just your layout manager that's
>>>>>messed up. You'll have this problem even after you set up your layout
>>>>>manager and layout data correctly. The solution is to call the
>>>>>Composite.layout() method when you open your shell. Incidentally, even
>>>>>SashForm doesn't work on Win XP if you contain it in a Composite, while
>>>>>it works on GTK. I'm still trying to find a work around for TabForm,
>>>>>which displays itself, but not it's children.
>>>>
>>>>
>>>>>Daniel
>
>
>
Re: SashForm works, Composite does not? [message #433299 is a reply to message #433150] Wed, 07 April 2004 02:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: purjo76.luukku.com

Hi again!

HereŽs one TabItem IŽm trying to show:

public class GeneralTab extends CTabItem
{
private CTabFolder parent;
private Composite composite;

public GeneralTab(CTabFolder parent, int style) {
super(parent, style);
this.parent = parent;
this.setText("General");
composite = new Composite(parent, SWT.NONE);
buildUI(); //Add components to composite
this.setControl(composite);
composite.layout();
}

private void buildUI()
{
Label pathLabel = new Label(composite, SWT.NULL);
pathLabel.setText("&Path to Executable:");

Text pathText = new Text(composite, SWT.BORDER | SWT.SINGLE);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
pathText.setLayoutData(gd);
}
}

Ralf Koban wrote:

> Hi Purjo,

> Please provide a snippet.

> Thanks
> Ralf

> Purjo schrieb:
> > A little correction: inside CTabItem, of course. I have a ViewPart that
> > has CTabFolder, and there are three CTabItems in it. But I just canŽt get
> > anything drawn on those:=(
> >
> > Purjo wrote:
> >
> >
> >>I also tried that, without any effect. How can this be made so difficult??
> >>I mean, it really doesnŽt give a good picture of SWT if itŽs so hard to
> >>get even few components drawn to the screen?? Why canŽt I just add a
> >>component inside another like in Swing, and they are shown ok??
> >
> >
> >>Could someone PLEASE show me how to draw two tables inside CTabFolder
> >>without using SashForm??
> >
> >
> >>Ralf Koban wrote:
> >
> >
> >>>Hi Purjo,
> >
> >
> >>>did you set the top control of your StackLayout? E.g.
> >
> >
> >>>layout.topControl = composite;
> >
> >
> >>>Can you provide a snippet?
> >
> >
> >>>Ralf
> >
> >
> >>>Purjo schrieb:
> >>>
> >>>>Thanks for your answer Daniel.
> >>>>
> >>>>Anyway, calling that layout() method did not help at all, still my
> >>>>Composite is empty? Any other ideas how to fix this problem??
> >>>>
> >>>>This is what I am doing now:
> >>>>
> >>>> Composite composite = new Composite(parent, SWT.HORIZONTAL);
> >>>> composite.setLayoutData(new GridData(GridData.FILL_BOTH));
> >>>> final StackLayout layout = new StackLayout();
> >>>> composite.setLayout(layout);
> >>>> createUI(); //method that draws other components on composite
> >>>> this.setControl(composite);
> >>>> sash.layout();
> >>>>
> >>>>
> >>>>Daniel Spiewak wrote:
> >>>>
> >>>>
> >>>>
> >>>>>I hate to break it to you, but it's not just your layout manager that's
> >>>>>messed up. You'll have this problem even after you set up your layout
> >>>>>manager and layout data correctly. The solution is to call the
> >>>>>Composite.layout() method when you open your shell. Incidentally, even
> >>>>>SashForm doesn't work on Win XP if you contain it in a Composite, while
> >>>>>it works on GTK. I'm still trying to find a work around for TabForm,
> >>>>>which displays itself, but not it's children.
> >>>>
> >>>>
> >>>>>Daniel
> >
> >
> >
Re: SashForm works, Composite does not? [message #433300 is a reply to message #433299] Wed, 07 April 2004 03:22 Go to previous messageGo to next message
Eclipse UserFriend
Hi Purjo,

for me it looks like your composite doesn't have a layout.
Does your parent have a layout e.g. FillLayout?

If that doesn't help, can you please provide a complete snippet
( http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/plat form-swt-home/faq.html#whatisasnippet).

Ralf

Purjo schrieb:
> Hi again!
>
> HereŽs one TabItem IŽm trying to show:
>
> public class GeneralTab extends CTabItem
> {
> private CTabFolder parent;
> private Composite composite;
>
> public GeneralTab(CTabFolder parent, int style) {
> super(parent, style);
> this.parent = parent;
> this.setText("General");
> composite = new Composite(parent, SWT.NONE);
> buildUI(); //Add components to composite
> this.setControl(composite);
> composite.layout();
> }
>
> private void buildUI()
> {
> Label pathLabel = new Label(composite, SWT.NULL);
> pathLabel.setText("&Path to Executable:");
>
> Text pathText = new Text(composite, SWT.BORDER | SWT.SINGLE);
> GridData gd = new GridData(GridData.FILL_HORIZONTAL);
> pathText.setLayoutData(gd);
> }
> }
>
> Ralf Koban wrote:
>
>
>>Hi Purjo,
>
>
>>Please provide a snippet.
>
>
>>Thanks
>>Ralf
>
>
>>Purjo schrieb:
>>
>>>A little correction: inside CTabItem, of course. I have a ViewPart that
>>>has CTabFolder, and there are three CTabItems in it. But I just canŽt get
>>>anything drawn on those:=(
>>>
>>>Purjo wrote:
>>>
>>>
>>>
>>>>I also tried that, without any effect. How can this be made so difficult??
>>>>I mean, it really doesnŽt give a good picture of SWT if itŽs so hard to
>>>>get even few components drawn to the screen?? Why canŽt I just add a
>>>>component inside another like in Swing, and they are shown ok??
>>>
>>>
>>>>Could someone PLEASE show me how to draw two tables inside CTabFolder
>>>>without using SashForm??
>>>
>>>
>>>>Ralf Koban wrote:
>>>
>>>
>>>>>Hi Purjo,
>>>
>>>
>>>>>did you set the top control of your StackLayout? E.g.
>>>
>>>
>>>>>layout.topControl = composite;
>>>
>>>
>>>>>Can you provide a snippet?
>>>
>>>
>>>>>Ralf
>>>
>>>
>>>>>Purjo schrieb:
>>>>>
>>>>>
>>>>>>Thanks for your answer Daniel.
>>>>>>
>>>>>>Anyway, calling that layout() method did not help at all, still my
>>>>>>Composite is empty? Any other ideas how to fix this problem??
>>>>>>
>>>>>>This is what I am doing now:
>>>>>>
>>>>>> Composite composite = new Composite(parent, SWT.HORIZONTAL);
>>>>>> composite.setLayoutData(new GridData(GridData.FILL_BOTH));
>>>>>> final StackLayout layout = new StackLayout();
>>>>>> composite.setLayout(layout);
>>>>>> createUI(); //method that draws other components on composite
>>>>>> this.setControl(composite);
>>>>>> sash.layout();
>>>>>>
>>>>>>
>>>>>>Daniel Spiewak wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>>I hate to break it to you, but it's not just your layout manager that's
>>>>>>>messed up. You'll have this problem even after you set up your layout
>>>>>>>manager and layout data correctly. The solution is to call the
>>>>>>>Composite.layout() method when you open your shell. Incidentally, even
>>>>>>>SashForm doesn't work on Win XP if you contain it in a Composite, while
>>>>>>>it works on GTK. I'm still trying to find a work around for TabForm,
>>>>>>>which displays itself, but not it's children.
>>>>>>
>>>>>>
>>>>>>>Daniel
>>>
>>>
>>>
>
>
Re: SashForm works, Composite does not? [message #433851 is a reply to message #432781] Tue, 13 April 2004 11:34 Go to previous message
Eclipse UserFriend
In my experience you do need to create a layout explicitly, even if it's an
empty FillLayout...

final SashForm form = new SashForm(shell,SWT.HORIZONTAL);

form.setBackground(new Color(display,new RGB(200,200,200)));

form.setLayout(new FillLayout());

form.SASH_WIDTH=4;



final Composite child = new Composite(form,SWT.NONE);

child.setLayout(new FillLayout());

Purjo wrote:

> Do I always have to define some layout for the Composite? Doesn?t it use a
> default layout if I don?t define any? Ans what do you mean with 'layout
> data on the children'?? Could you please give me some example code to
> solve this issue....
>
> Thomas Mäder wrote:
>
>> You guess you don't have a layout on the composite, or you might be
>> missing the correct layout data on the children.
>
>> Thomas
>
>> Purjo wrote:
>
>> > Hi!
>> >
>> > I?m creating a simple view with a table and a few buttons in it.
>> >
>> > The problem is: if I create a SashForm and give it as a parent for my
>> > components, everything is ok. But if I create a Composite as a parent
>> > for my components, nothing is drawn on my view, i.e. it is empty!!
>> > Why?s that?? I really don?t need the SashForm, because I would like the
>> > screen to be divided statically, so what do I have to do to make
>> > components visible in Composite??
>> >
Previous Topic:Embedded JSplitPane resizable arrows
Next Topic:Internet Explorer ActiveX component - get page source?
Goto Forum:
  


Current Time: Wed Sep 24 04:54:15 EDT 2025

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

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

Back to the top