Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » label length within form toolkit
label length within form toolkit [message #638655] Thu, 11 November 2010 19:49 Go to next message
Eclipse UserFriend
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 16:09 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: label length within form toolkit [message #639952 is a reply to message #638880] Thu, 18 November 2010 09:20 Go to previous message
Eclipse UserFriend
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: Mon Jul 28 09:34:35 EDT 2025

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

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

Back to the top