Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Text widget - auto-resizing, shouldn't
Text widget - auto-resizing, shouldn't [message #443053] Fri, 17 September 2004 19:22 Go to next message
Arthur Casals is currently offline Arthur CasalsFriend
Messages: 6
Registered: July 2009
Junior Member
Hello,

I'm using a little shell to get some input texts, so I've used a
GridLayout on it, with two columns (Labels go left, Texts go right,
Buttons go below). Since I'm using a Combo in the right column, all the
Texts auto-size to the Combo´s width, making the layout beautiful and
everyone happy. The problem is: when I edit all the text I've input, the
Texts receive the old values (using append or setText, I've tried both),
and they auto-resize their width to the old input's length... so, if the
original input for a specific Text was "a", for example, this widget
auto-resizes its to fit only one char (width). Not beautiful. Any ideas? :)


Regards,


Arthur Casals
Re: Text widget - auto-resizing, shouldn't [message #443066 is a reply to message #443053] Fri, 17 September 2004 22:44 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
I assume you are doing this in an SWT.Verify handler or SWT.KeyDown handler?
Use Display.asyncExec() to run the code that grows the text control after
the operating system has processed the character and inserted it.

"Arthur Casals" <arthur@deltacore.com.br> wrote in message
news:cifd9d$9d6$1@eclipse.org...
> Hello,
>
> I'm using a little shell to get some input texts, so I've used a
> GridLayout on it, with two columns (Labels go left, Texts go right,
> Buttons go below). Since I'm using a Combo in the right column, all the
> Texts auto-size to the Combo
Re: Text widget - auto-resizing, shouldn't [message #443108 is a reply to message #443066] Sat, 18 September 2004 01:33 Go to previous messageGo to next message
Arthur Casals is currently offline Arthur CasalsFriend
Messages: 6
Registered: July 2009
Junior Member
Steve Northover wrote:
> I assume you are doing this in an SWT.Verify handler or SWT.KeyDown handler?

In fact, it's simpler than that... s'th like this:


final Button button_OpenShell = new Button(parentShell, SWT.NONE);
button_OpenShell.addSelectionListener(new SelectionAdapter() {

public void widgetSelected(SelectionEvent e) {

Shell shell = new Shell(SWT.FOO);
final GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
shell.setLayout(gridLayout);
shell.setBounds(300,300,172, 227);
shell.setText("Shell");

final Text text = new Text(shell, SWT.BORDER);
text.setText(table.getItem(index).getText(0));

}

});

Then, table.getItem(index).getText(0) rules the (Text)text width...

Any sugestions?

Regards,


Arthur Casals
Re: Text widget - auto-resizing, shouldn't [message #443110 is a reply to message #443108] Sat, 18 September 2004 15:14 Go to previous message
Arthur Casals is currently offline Arthur CasalsFriend
Messages: 6
Registered: July 2009
Junior Member
Solved. As the Enlightened Green Jelly Dancing Beings say: "KISS - Keep
It Simple, Stupid".

Since I was using a GridLayout in the shell:

text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL |
GridData.GRAB_HORIZONTAL));

That was the last idea before creating a
normalizeString/whyCantWeBeFriends method.


Thanks for the help.

Regards,

Arthur Casals
Previous Topic:Hatching
Next Topic:Adding dynamicly pages to the wizard?
Goto Forum:
  


Current Time: Fri Apr 26 14:34:00 GMT 2024

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

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

Back to the top