Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » label length within form toolkit
label length within form toolkit [message #638655] Fri, 12 November 2010 00:49 Go to next message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Hi all,
in my application I'm using a form toolkit for an editor and, besides all the widgets, I'd like to display a label that will report some error/notice messages. Since the layout of the form is a table wrap layout with two columns, I've defined such label as follows:

Label errorLabel = toolkit.createLabel( parent, "" );
errorLabel.setForeground( Display.getCurrent().getSystemColor( SWT.COLOR_RED ) );
TableWrapData twData = new TableWrapData();
twData.align = TableWrapData.CENTER;
twData.grabHorizontal = true;
twData.colspan = 2;
errorLabel.setLayoutData( twData );


The problem is that, when I set the text of the label after certain event occurs, the label does not show anything. After a while of testing I found that the label cannot display a new text longer than the one specified at the creation time, that is if I change the first line with the following:

Label errorLabel = toolkit.createLabel( parent, "     " );  // 5 blanks


the text can be changed to a string no more longer than 5 characters.
Am I doing something wrong or is not possible to change the length of a label when it is created by a form toolkit?

Thanks.
Re: label length within form toolkit [message #638880 is a reply to message #638655] Fri, 12 November 2010 21:09 Go to previous messageGo to next message
Lakshmi P ShanmugamFriend
Messages: 279
Registered: July 2009
Location: India
Senior Member
Hi,

You could try setting the align flag to twData.align = TableWrapData.FILL or set align to TableWrapData.FILL_GRAB in the constructor. If required, set SWT.CENTER style on the label in toolkit.createLabel() so that the text is center aligned within the label.

UI Forms related questions belong to the Platform User Assistance forum. So, you could post your question there to get the best answer.


Lakshmi P Shanmugam
Re: label length within form toolkit [message #639952 is a reply to message #638880] Thu, 18 November 2010 14:20 Go to previous message
Luca Ferrari is currently offline Luca FerrariFriend
Messages: 159
Registered: November 2009
Senior Member
Lakshmi Shanmugam wrote on Fri, 12 November 2010 16:09
Hi,

You could try setting the align flag to twData.align = TableWrapData.FILL


Thanks, that solved my problem!
Previous Topic:[SOLVED] Setting limit to Sash position doesn't work on Mac OS X
Next Topic:SWT.TRANSPARENT on linux?
Goto Forum:
  


Current Time: Thu Apr 25 08:18:01 GMT 2024

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

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

Back to the top