0

Hi all,

I'm a newbie for SWT, all was fine until now.
I got a simple app with some buttons and text fields. I'd like to update the text field with incoming messages and show it to the user.

Display display = new Display();
Shell shell = new Shell(display);

messageField = new Text (shell, SWT.BORDER);
messageField.setBounds(10, 100, 150, 100);
messageField.setEditable(false);

messageField.append("1st");


shell.setBounds(10, 10, 600, 1400);
shell.pack ();

shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}

display.dispose ();
		
messageField.append("2nd");

Now, I can see "1st" but not "2nd" because it's called after the display.dispose ();
OK, but how can I update a text field after the app is shown on the screen?

Thanks in advance

Edited by __avd: Wrong title. Add [code] tags. Encase your code in: [code] and [/code] tags.

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by zortec
0

#
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}

display.dispose ();

while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        // If no more entries in event queue
        display.sleep();
      }
    }

private void init() {
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.