| Summary: | Simple DateTime example is not rendered when accessed repeatedly | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Johannes Eickhold <jeick> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 2.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
I think that the snippet is not so correct. You have two shell.open() - one before DateTime creation and one after. In the first run the DateTime widget is shown due to re-layout from the TextSizeDetermination. In the second run the Shell is opened before DateTime creation and layout() on Shell is not called -> DateTime has zero bounds. If you want to keep the call to shell.open() before DateTime widget creation you must call shell.layout() afterwards. In other case, removing the first shell.open() fixes the problem. Please reopen if you disagree. |
The following snippet only renders the DateTime widget when the EntryPoint is accessed from a browser for the first time. On reloads an empty page appears. public class MiniSandbox implements IEntryPoint { public int createUI() { final Display display = new Display(); Shell shell = new Shell( display, SWT.NO_TRIM ); shell.setText( "Snippet" ); shell.setMaximized( true ); shell.setLayout( new FillLayout() ); shell.open(); final DateTime dateTime = new DateTime( shell, SWT.BORDER | SWT.DATE | SWT.LONG ); dateTime.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected( SelectionEvent e ) { System.out.println( dateTime.getDay() + "." + dateTime.getMonth() + "." + dateTime.getYear() + " - " + dateTime.getHours() + ":" + dateTime.getMinutes() + ":" + dateTime.getSeconds() ); } } ); shell.open(); return 0; }