Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » add remove widget from composite @ runtime
add remove widget from composite @ runtime [message #665873] Sun, 17 April 2011 18:46 Go to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
HI,

How to remove widget to composite @ runtime
and reinsert another widget at the same place

any code snippet available ?

thanks
ashopk

[Updated on: Sun, 17 April 2011 18:47]

Report message to a moderator

Re: add remove widget from composite @ runtime [message #665899 is a reply to message #665873] Mon, 18 April 2011 05:08 Go to previous messageGo to next message
Prakash G.R. is currently offline Prakash G.R.Friend
Messages: 621
Registered: July 2009
Senior Member
On 18/04/11 12:16 AM, ash wrote:
> How to add widget to composite @ runtime
> and reinsert another widget at the same place

new widget(composite);
oldwidget.dispose();
composite.layout();

--
- Prakash
Platform UI Team, IBM

www.eclipse-tips.com
Re: add remove widget from composite @ runtime [message #665967 is a reply to message #665873] Mon, 18 April 2011 11:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/17/2011 02:46 PM, ash wrote:
> HI,
>
> How to add widget to composite @ runtime
> and reinsert another widget at the same place

In addition, you can use
control.moveAbove(sibling)/control.moveBelow(sibling) to place your new
control somewhere useful.

If you use GridLayout, you can also temporarily exclude a widget from
the layout, and set it visible==false and it will disappear, instead of
disposing/re-creating.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: add remove widget from composite @ runtime [message #665972 is a reply to message #665967] Mon, 18 April 2011 12:18 Go to previous messageGo to next message
ash is currently offline ashFriend
Messages: 142
Registered: July 2010
Senior Member
Does this add the control in the same position.

Because i tryed the same logic of disposing the widget
and create widget and called composite.pack

it dint add in the same position. It just append the control @
end of composite ....
Re: add remove widget from composite @ runtime [message #665987 is a reply to message #665972] Mon, 18 April 2011 13:05 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/18/2011 08:18 AM, ash wrote:
>
> it dint add in the same position. It just append the control @ end of
> composite ....

Right, new will just add the control at the end of the composite's
children. Use moveAbove/moveBelow to place it relative to one of the
other children.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:remove Finsh button From Wizard Dialog
Next Topic:Multiple applications bundled in a single product / DS conflicts
Goto Forum:
  


Current Time: Thu Dec 18 02:30:56 GMT 2014

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

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