I have a MyComposite class, where I want to animate the Size change.
For that I am changing the size in a loop.
After each loopteration I call layout().
Unfortunately the Composite doesnÄt repaint after each iteration, but jumps directly to the final size of my Composite.
How can I force the Widget to redraw on every size change?
MyComposite and Animation:
//start
new Animation().start(myComposite);
...
public MyComposite(Composite parent, int style, int bgcolor) {
super(parent, style);
this.setBackground(getDisplay().getSystemColor(bgcolor));
}
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
return super.computeSize(width, height, changed);
}
class Animation{
public void start(MyComposite composite){
for(int i=0; i<1000; i++){
composite.width++;
composite.getParent().layout(true, true);
}
}
}
MyComposite:
The redrawing works as following:
So the problem was, that I did not trigger the repaint request to be done IMMEDIATELY.
The correct animation function looks like: