Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » StackLayout problem
StackLayout problem [message #466751] Tue, 17 January 2006 12:46 Go to next message
Eclipse User
Originally posted by: clau349.hotmail.com

I got a tree and i use a StackLayout to show the properties of each item of my tree... My StackLayout code is:

StackLayout stack = new StackLayout();
composite.setLayout(stack);

Group[] group = new Group[1];
group[0] = new Group(composite,SWT.NONE);
group[0].setText(string);
GridLayout gl = new GridLayout();
group[0].setLayout(gl);
Label l = new Label(group[0],SWT.NONE);
l.setText("Name");
Text b = new Text(group[0], SWT.NONE);
b.setLayoutData(new GridData (GridData.FILL_HORIZONTAL));
b.setText(string);
stack.topControl = group[0];


But when I call for the method several times or clicked many items in my tree, eclipse throws me:

Unhandled event loop exception
Reason:
No more handles

I think This is because when a i clik a item i create a new Stacklayout, but when i click another one item another Stacklayout is created and so on. But StackLayouts created before doesn`t be destroyed so the memory can´t handle it...

There is some way to destroy the Stacklayouts that i do not use or somenthing...

Thank for help me out
Re: StackLayout problem [message #466762 is a reply to message #466751] Tue, 17 January 2006 15:11 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
You should call dispose() on group[0] when you don't need it anymore or
possibly on composite (the parent of group) depending on what widgets you
are creating each time you lick on a new item. StackLayout() does not use
up handles but the new widgets you have created do.

I am not sure about your comment "when a i clik a item i create a new
Stacklayout". Why are you using a StackLayout? It sounds like you only
have one child in the StackLayout so why not use FillLayout()?

"claude" <clau349@hotmail.com> wrote in message
news:21622368.1137502022800.JavaMail.root@cp1.javalobby.org...
>I got a tree and i use a StackLayout to show the properties of each item of
>my tree... My StackLayout code is:
>
> StackLayout stack = new StackLayout();
> composite.setLayout(stack);
>
> Group[] group = new Group[1];
> group[0] = new Group(composite,SWT.NONE);
> group[0].setText(string);
> GridLayout gl = new GridLayout();
> group[0].setLayout(gl);
> Label l = new Label(group[0],SWT.NONE);
> l.setText("Name");
> Text b = new Text(group[0], SWT.NONE);
> b.setLayoutData(new GridData (GridData.FILL_HORIZONTAL));
> b.setText(string);
> stack.topControl = group[0];
>
>
> But when I call for the method several times or clicked many items in my
> tree, eclipse throws me:
>
> Unhandled event loop exception
> Reason:
> No more handles
>
> I think This is because when a i clik a item i create a new Stacklayout,
> but when i click another one item another Stacklayout is created and so
> on. But StackLayouts created before doesn`t be destroyed so the memory
> can
Re: StackLayout problem [message #466797 is a reply to message #466762] Tue, 17 January 2006 19:10 Go to previous messageGo to next message
Eclipse User
Originally posted by: clau349.hotmail.com

yeah.. you are right, I can use a fillLayout but the problem is that when i click a item in my tree, my StackLayout or FillLayout shows me the properties of my tree´s item like a label with my tree item name for example, but when i click another item then i got 2 labels, when i click another item i got 3 labels and so on. That my problem, i cannot erase the labels that i do not use anymore.


I call the method from my:

public void propertyChange(PropertyChangeEvent evt )

So i can refresh when i clicked en my tree item directly.

When i use the next code:

Control[] d = this.composite.getChildren();
System.out.println(d.lenght);

I can see that "d" stores the children... it starts with 1,2,3..... (I got the same numbers of labels in my application)when it arrives about 3000, throws me a handle error...

It must be a way to control that but could not be possible for me..

Thanks for any help you can give me....
Re: StackLayout problem [message #466814 is a reply to message #466797] Tue, 17 January 2006 21:02 Go to previous message
Veronika Irvine is currently offline Veronika Irvine
Messages: 1272
Registered: July 2009
Senior Member
You need to call dispose() on the widgets that are no longer in use. If the
whole group is no longer in use you could just dispose the group and it will
take care of its children. Using the StackLayout is just hiding the fact
that you have thousands of leaked widgets.

I am not sure exactly where you should do the cleanup - this is a question
best asked on the eclipse.platform newsgroup. They can tell you what the
usual lifecycle looks like.

"claude" <clau349@hotmail.com> wrote in message
news:1663068.1137525071464.JavaMail.root@cp1.javalobby.org...
> yeah.. you are right, I can use a fillLayout but the problem is that when
> i click a item in my tree, my StackLayout or FillLayout shows me the
> properties of my tree
Previous Topic:bypassing default combo key reaction
Next Topic:Disabled icon palettes
Goto Forum:
  


Current Time: Sat Sep 20 22:08:03 GMT 2014

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

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