Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » how to force refresh on a Composite?
how to force refresh on a Composite? [message #118232] Mon, 12 January 2009 04:18 Go to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Hello! I have created a custom control, which extends Composite (anc
contains a ScrolledComposite). It generates a table of data and/or form
controls. I am having trouble refreshing this control. When I change the
control's data and layout(), my control is invisible. If however I resize
the screen, it shows up! How can I force my composite to show up? My
controlResized() is below.

scrolledComposite.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
scrolledComposite.setMinSize(scrolledComposite.computeSize(S WT.DEFAULT,
SWT.DEFAULT));
}
});

Within my control's code, I try to force a refresh by calling the same
method
scrolledComposite.setMinSize(scrolledComposite.computeSize(S WT.DEFAULT,
SWT.DEFAULT));
but that fails as well.

Thanks!
David Donohue
Re: how to force refresh on a Composite? [message #118260 is a reply to message #118232] Mon, 12 January 2009 11:00 Go to previous messageGo to next message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi David,

ScrolledComposites are tricky and they are many ways to go wrong. I'd
recommend experimenting with a simple snippet in SWT first. If you have
a snippet that works with SWT and doesn't with RWT, feel free to file a
bug, then we can look into it.

Best regards, Ralf

David Donohue wrote:
> Hello! I have created a custom control, which extends Composite (anc
> contains a ScrolledComposite). It generates a table of data and/or form
> controls. I am having trouble refreshing this control. When I change
> the control's data and layout(), my control is invisible. If however I
> resize the screen, it shows up! How can I force my composite to show
> up? My controlResized() is below.
> scrolledComposite.addControlListener(new ControlAdapter() {
> public void controlResized(ControlEvent e) {
>
> scrolledComposite.setMinSize(scrolledComposite.computeSize(S WT.DEFAULT,
> SWT.DEFAULT));
> }
> });
>
> Within my control's code, I try to force a refresh by calling the same
> method
> scrolledComposite.setMinSize(scrolledComposite.computeSize(S WT.DEFAULT,
> SWT.DEFAULT));
> but that fails as well.
>
> Thanks!
> David Donohue
>
Re: how to force refresh on a Composite? [message #118612 is a reply to message #118260] Mon, 19 January 2009 11:32 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
Ralf,
Just to follow up on this problem. I figured out that the intermittent
vanishing of my ScrolledComposite occurs when its contents have the same
content as before. Example:
Render in my composite results 1-10 ... OK
Render in my composite results 11-20 ... OK
Go BACK and render in my composite results 1-10 again ... Blank, until I
resize
Go FORWARD and render in my composite results 21-30 ... OK

This workaround works for me: After my ScrolledComposite (in the a
different composite was added just after the ScrolledComposite) I add a
blank composite, with random content. Now my ScrolledComposite shows up
every time.

scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL |
SWT.H_SCROLL);
scrolledComposite.setLayout(new GridLayout(1, true));
...
unscrolledBottomComposite = new Composite(container, SWT.NONE);
Text hiddenText = new Text(unscrolledBottomComposite, SWT.NONE);
hiddenText.setVisible(false);
hiddenText.setText(UUID.randomUUID().toString());

David Donohue
Re: how to force refresh on a Composite? [message #118647 is a reply to message #118612] Mon, 19 January 2009 12:32 Go to previous messageGo to next message
NkD Missing name is currently offline NkD Missing nameFriend
Messages: 61
Registered: July 2009
Member
You can try Composite.layout() method. It is not exactly as resize, but
in my case it is sufficient.

NkD

David Donohue napsal(a):
> Ralf,
> Just to follow up on this problem. I figured out that the intermittent
> vanishing of my ScrolledComposite occurs when its contents have the same
> content as before. Example: Render in my composite results 1-10 ... OK
> Render in my composite results 11-20 ... OK
> Go BACK and render in my composite results 1-10 again ... Blank, until I
> resize
> Go FORWARD and render in my composite results 21-30 ... OK
>
> This workaround works for me: After my ScrolledComposite (in the a
> different composite was added just after the ScrolledComposite) I add a
> blank composite, with random content. Now my ScrolledComposite shows up
> every time.
>
> scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL |
> SWT.H_SCROLL);
> scrolledComposite.setLayout(new GridLayout(1, true));
> ...
> unscrolledBottomComposite = new Composite(container, SWT.NONE);
> Text hiddenText = new Text(unscrolledBottomComposite, SWT.NONE);
> hiddenText.setVisible(false);
> hiddenText.setText(UUID.randomUUID().toString());
>
> David Donohue
>
Re: how to force refresh on a Composite? [message #118730 is a reply to message #118647] Mon, 19 January 2009 15:15 Go to previous messageGo to next message
David Donohue is currently offline David DonohueFriend
Messages: 104
Registered: July 2009
Senior Member
i tried Composite.layout() but it did not make my ScrolledComposite show
up.
Re: how to force refresh on a Composite? [message #118757 is a reply to message #118612] Mon, 19 January 2009 16:06 Go to previous message
Ralf Sternberg is currently offline Ralf SternbergFriend
Messages: 1313
Registered: July 2009
Senior Member

Hi David,

I'm sorry, but I don't understand what you exactly doing from your
description. Please provide a complete and *simple* snippet to reproduce
the problem and please make sure that your code works with SWT.

BTW, there's no use setting a layout on a SC, as it manages its own
layout. This statement is simply ignored.

Regards, Ralf

David Donohue wrote:
> Ralf,
> Just to follow up on this problem. I figured out that the intermittent
> vanishing of my ScrolledComposite occurs when its contents have the same
> content as before. Example: Render in my composite results 1-10 ... OK
> Render in my composite results 11-20 ... OK
> Go BACK and render in my composite results 1-10 again ... Blank, until I
> resize
> Go FORWARD and render in my composite results 21-30 ... OK
>
> This workaround works for me: After my ScrolledComposite (in the a
> different composite was added just after the ScrolledComposite) I add a
> blank composite, with random content. Now my ScrolledComposite shows up
> every time.
>
> scrolledComposite = new ScrolledComposite(container, SWT.V_SCROLL |
> SWT.H_SCROLL);
> scrolledComposite.setLayout(new GridLayout(1, true));
>
> unscrolledBottomComposite = new Composite(container, SWT.NONE);
> Text hiddenText = new Text(unscrolledBottomComposite, SWT.NONE);
> hiddenText.setVisible(false);
> hiddenText.setText(UUID.randomUUID().toString());
>
> David Donohue
>
Previous Topic:Interrupt handling
Next Topic:Drag and drop in RAP applications
Goto Forum:
  


Current Time: Fri Apr 26 08:15:58 GMT 2024

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

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

Back to the top