|Text vs. StyledText screen updates [message #900082]
||Fri, 03 August 2012 16:48
| Doug M
Registered: December 2009
Hello. I would like to understand what happens when a Text is changed and updated in the ReadAndDispatch event loop. What I see is an unacceptable amount of flicker with Text but not with StyledText.|
For example, I have a Text, enclosed in various Composites that represent a document, page, section, and paragraph. I dispose that Text and the immediately enclosing Composite. Next, a new Text is made, different content, same size, same enclosure, and that happens to be placed at the same position.
There is no change to the screen when the above changes happen. Once coming back to the event loop, the first call to ReadAndDispatch erases the old text from the screen. Then follow ten to twelve passes thru ReadAndDispatch until the new text gets drawn. Granted, there are other changes to the page that RD may be processing. But the delays between erasing of the old and drawing of the new creates an orgy of flickering on the screen.
Can an expert in SWT please explain to me what is going on? Is it that the dispose and new queue high-level SWT Paint events, and these are not re-ordered or consolidated, as they would be at the OS level? Is there any hope for getting the erase and redraw of one element to happen more simultaneously?
Things I have tried to no effect (this is with OS X Cocoa):
1) update() on the new Text. That area of screen is immediately erased. But, contrary to the claims of the docs, the new text is NOT drawn immediately, but only when reaching the event loop.
2) Various combinations of SWT.DOUBLE_BUFFERED and SWT.NO_BACKGROUND. These seem to have no effect on the problem.
In contrast, StyledText under the same circumstances updates without any visible flicker. The screen is changed to the new content during the first call to readAndDispatch, without any visible erase and redraw.
Thanks for any explanations, insights, and workarounds!
[Updated on: Sat, 04 August 2012 19:11]
Report message to a moderator