Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » ScrolledComposite setContent problem
ScrolledComposite setContent problem [message #465704] Tue, 20 December 2005 09:21 Go to next message
Eclipse UserFriend
Originally posted by: dozerox.gmail.com

Hi,

I'm trying to change a ScrolledComposite content with setContent. When I
set a Composite to the ScrolledComposite for the first time, It shows up
fine, but when I set the same Composite later on to the same
ScrolledComposite it doesn't show up anymore. I checked in debug that
the ScrolledComposite gets the setted Composite to its content, but it
just don't show up. Here's some code of what i've tried to do:

//class variables for the composites
private Composite compBasicInfo = null;
private Composite compMail = null;
private ScrolledComposite scrollComp = null;

//the code that creates the composites
groupContent = new Group(sShell, SWT.NONE);
groupContent.setLayoutData(new GridData(GridData.FILL_BOTH));
scrollComp = new ScrolledComposite(groupContent, SWT.H_SCROLL |
SWT.V_SCROLL);
compBasicInfo = new BasicInfoPage(scrollComp,SWT.NONE);
compMail = new MailPage(scrollComp,SWT.NONE);
groupContent.setLayout(new FillLayout());
groupContent.layout(true);

//the code that sets the content to the scrolledcomposite
if(((String)(itemSelected.getData())).equals("basicInformation ")){
scrollComp.setVisible(true);
compBasicInfo.setVisible(true);
scrollComp.setContent(compBasicInfo);
}
if(((String)(itemSelected.getData())).equals("mail")){
scrollComp.setVisible(true);
compMail.setVisible(true);
scrollComp.setContent(compMail);
}

So what I mean is that when that above code is used, the
ScrolledComposite shows the composite (that has been set up with
setContent) when it is set up for the first time. But when it is set
again later on, it wont show up?

Thanks in advance for any help!
Re: ScrolledComposite setContent problem [message #465705 is a reply to message #465704] Tue, 20 December 2005 09:38 Go to previous messageGo to next message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
Try doing a relayout of the scrollComp after setting the content.

Another thing to look out for: Sometime not setting a layout on a
component can cause behaviour as you describe it. So check all your
components if they hava a layout assigned to them.

Regards
Stefan

doze wrote:
> Hi,
>
> I'm trying to change a ScrolledComposite content with setContent. When I
> set a Composite to the ScrolledComposite for the first time, It shows up
> fine, but when I set the same Composite later on to the same
> ScrolledComposite it doesn't show up anymore. I checked in debug that
> the ScrolledComposite gets the setted Composite to its content, but it
> just don't show up. Here's some code of what i've tried to do:
>
> //class variables for the composites
> private Composite compBasicInfo = null;
> private Composite compMail = null;
> private ScrolledComposite scrollComp = null;
>
> //the code that creates the composites
> groupContent = new Group(sShell, SWT.NONE);
> groupContent.setLayoutData(new GridData(GridData.FILL_BOTH));
> scrollComp = new ScrolledComposite(groupContent, SWT.H_SCROLL |
> SWT.V_SCROLL);
> compBasicInfo = new BasicInfoPage(scrollComp,SWT.NONE);
> compMail = new MailPage(scrollComp,SWT.NONE);
> groupContent.setLayout(new FillLayout());
> groupContent.layout(true);
>
> //the code that sets the content to the scrolledcomposite
> if(((String)(itemSelected.getData())).equals("basicInformation ")){
> scrollComp.setVisible(true);
> compBasicInfo.setVisible(true);
> scrollComp.setContent(compBasicInfo);
> }
> if(((String)(itemSelected.getData())).equals("mail")){
> scrollComp.setVisible(true);
> compMail.setVisible(true);
> scrollComp.setContent(compMail);
> }
>
> So what I mean is that when that above code is used, the
> ScrolledComposite shows the composite (that has been set up with
> setContent) when it is set up for the first time. But when it is set
> again later on, it wont show up?
>
> Thanks in advance for any help!
Re: ScrolledComposite setContent problem [message #465711 is a reply to message #465705] Tue, 20 December 2005 11:20 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: dozerox.gmail.com

Hi,

scrollComp did not have any layout in it, but I tried a few and
relayouted it after setting the content. No joy.. I can go around this
by doing a separate ScrolledComposite for each composite and then use
stacklayout to show/hide correct content in the group (tried this and
works), but it would be simpler to do it with just one, if possible.

So to be clear, setting a layout in scrollComp and doing
scrollComp.layout() didn't help. It's the same as before, first time
when setting a composite to scrollComp, it shows, after that when
resetting the same composite, nothing (but when setting a composite that
has not yet been in the scrollComp it shows).

Stefan Langer wrote:
> Try doing a relayout of the scrollComp after setting the content.
>
> Another thing to look out for: Sometime not setting a layout on a
> component can cause behaviour as you describe it. So check all your
> components if they hava a layout assigned to them.
>
> Regards
> Stefan
>
> doze wrote:
>
>> Hi,
>>
>> I'm trying to change a ScrolledComposite content with setContent. When
>> I set a Composite to the ScrolledComposite for the first time, It
>> shows up fine, but when I set the same Composite later on to the same
>> ScrolledComposite it doesn't show up anymore. I checked in debug that
>> the ScrolledComposite gets the setted Composite to its content, but it
>> just don't show up. Here's some code of what i've tried to do:
>>
>> //class variables for the composites
>> private Composite compBasicInfo = null;
>> private Composite compMail = null;
>> private ScrolledComposite scrollComp = null;
>>
>> //the code that creates the composites
>> groupContent = new Group(sShell, SWT.NONE);
>> groupContent.setLayoutData(new GridData(GridData.FILL_BOTH));
>> scrollComp = new ScrolledComposite(groupContent, SWT.H_SCROLL |
>> SWT.V_SCROLL);
>> compBasicInfo = new BasicInfoPage(scrollComp,SWT.NONE);
>> compMail = new MailPage(scrollComp,SWT.NONE);
>> groupContent.setLayout(new FillLayout());
>> groupContent.layout(true);
>>
>> //the code that sets the content to the scrolledcomposite
>> if(((String)(itemSelected.getData())).equals("basicInformation ")){
>> scrollComp.setVisible(true);
>> compBasicInfo.setVisible(true);
>> scrollComp.setContent(compBasicInfo);
>> }
>> if(((String)(itemSelected.getData())).equals("mail")){
>> scrollComp.setVisible(true);
>> compMail.setVisible(true);
>> scrollComp.setContent(compMail);
>> }
>>
>> So what I mean is that when that above code is used, the
>> ScrolledComposite shows the composite (that has been set up with
>> setContent) when it is set up for the first time. But when it is set
>> again later on, it wont show up?
>>
>> Thanks in advance for any help!
Re: ScrolledComposite setContent problem [message #465909 is a reply to message #465711] Wed, 21 December 2005 20:38 Go to previous message
Stefan Langer is currently offline Stefan LangerFriend
Messages: 236
Registered: July 2009
Senior Member
I didn't mean the scrollComp itself but the body contained in the
scrollComp. The layout setting was realted to the children of the
scrollComp.
But this might not be the problem in your case.

Regards
Stefan

doze wrote:
> Hi,
>
> scrollComp did not have any layout in it, but I tried a few and
> relayouted it after setting the content. No joy.. I can go around this
> by doing a separate ScrolledComposite for each composite and then use
> stacklayout to show/hide correct content in the group (tried this and
> works), but it would be simpler to do it with just one, if possible.
>
> So to be clear, setting a layout in scrollComp and doing
> scrollComp.layout() didn't help. It's the same as before, first time
> when setting a composite to scrollComp, it shows, after that when
> resetting the same composite, nothing (but when setting a composite that
> has not yet been in the scrollComp it shows).
>
> Stefan Langer wrote:
>
>> Try doing a relayout of the scrollComp after setting the content.
>>
>> Another thing to look out for: Sometime not setting a layout on a
>> component can cause behaviour as you describe it. So check all your
>> components if they hava a layout assigned to them.
>>
>> Regards
>> Stefan
>>
>> doze wrote:
>>
>>> Hi,
>>>
>>> I'm trying to change a ScrolledComposite content with setContent.
>>> When I set a Composite to the ScrolledComposite for the first time,
>>> It shows up fine, but when I set the same Composite later on to the
>>> same ScrolledComposite it doesn't show up anymore. I checked in debug
>>> that the ScrolledComposite gets the setted Composite to its content,
>>> but it just don't show up. Here's some code of what i've tried to do:
>>>
>>> //class variables for the composites
>>> private Composite compBasicInfo = null;
>>> private Composite compMail = null;
>>> private ScrolledComposite scrollComp = null;
>>>
>>> //the code that creates the composites
>>> groupContent = new Group(sShell, SWT.NONE);
>>> groupContent.setLayoutData(new GridData(GridData.FILL_BOTH));
>>> scrollComp = new ScrolledComposite(groupContent, SWT.H_SCROLL |
>>> SWT.V_SCROLL);
>>> compBasicInfo = new BasicInfoPage(scrollComp,SWT.NONE);
>>> compMail = new MailPage(scrollComp,SWT.NONE);
>>> groupContent.setLayout(new FillLayout());
>>> groupContent.layout(true);
>>>
>>> //the code that sets the content to the scrolledcomposite
>>> if(((String)(itemSelected.getData())).equals("basicInformation ")){
>>> scrollComp.setVisible(true);
>>> compBasicInfo.setVisible(true);
>>> scrollComp.setContent(compBasicInfo);
>>> }
>>> if(((String)(itemSelected.getData())).equals("mail")){
>>> scrollComp.setVisible(true);
>>> compMail.setVisible(true);
>>> scrollComp.setContent(compMail);
>>> }
>>>
>>> So what I mean is that when that above code is used, the
>>> ScrolledComposite shows the composite (that has been set up with
>>> setContent) when it is set up for the first time. But when it is set
>>> again later on, it wont show up?
>>>
>>> Thanks in advance for any help!
Previous Topic:SWT Fonts
Next Topic:X Window System Error using SWT_AWT Bridge on Linux
Goto Forum:
  


Current Time: Sat Dec 07 15:50:50 GMT 2024

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

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

Back to the top