Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Realign ragged-left TableEditor after update(Or: how to re-layout a TableEditor?)
Realign ragged-left TableEditor after update [message #1708612] Fri, 18 September 2015 06:43 Go to next message
Piero Campalani is currently offline Piero CampalaniFriend
Messages: 111
Registered: January 2015
Senior Member

Dear list,

I injected a TableEditor inside a SWT Table, with ragged-left alignment (SWT.RIGHT).
Something like:

final TableEditor editor = new TableEditor(table);
editor.horizontalAlignment = SWT.RIGHT;
editor.setEditor(toDisplay, item, 1);


toDisplay is a 2x1 GridLayout composite with two children:


  1. a dynamic Label
  2. a button


My issue is: when the dynamic label updates (gets wider), the toDisplay wrapper composite shifts outside of the table column instead of realigning as a good ragged-left boy [a screenshot of this behaviour is attached].

Layout data for both children is set via:

GridDataFactory.fillDefaults().create()


The button has a SelectionListeners which updates the text, then lays-out the parent composite.

It seems all combinations of .pack() and .layout() do not affect the editor.
Any idea of what might help?

Thanks for the help,
-Piero

[Updated on: Fri, 18 September 2015 06:59]

Report message to a moderator

Re: Realign ragged-left TableEditor after update [message #1708649 is a reply to message #1708612] Fri, 18 September 2015 11:48 Go to previous message
Piero Campalani is currently offline Piero CampalaniFriend
Messages: 111
Registered: January 2015
Senior Member

Solution is: re-set the minimum width of the TableEditor and re-lay it out:

editor.minimumWidth = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
editor.layout();


See: http://stackoverflow.com/questions/32645683/re-align-ragged-left-swt-tableeditor-after-content-updated

[Updated on: Fri, 18 September 2015 11:48]

Report message to a moderator

Previous Topic:How to set id`s to org.eclipse.swt.widgets.Table items and rows
Next Topic:SWT API only Jar
Goto Forum:
  


Current Time: Mon Dec 11 23:01:15 GMT 2017

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

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