GUI update [message #461790] |
Fri, 30 September 2005 04:34  |
Eclipse User |
|
|
|
Hi
I have a thread that is updating my GUI. While this update is going on, I
would like to stop redrawing until the SashForm's weights have been set, to
avoid screen flickering. However, if I click the mouse somewhere on the
screen while screen redraw is turned off, then my application will loose
focus to whatever program is showing behind it. How can I avoid this?
Code:
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
SashForm sashA =
(SashForm)PriceElementEditor.getForm().getParent();
SashForm sashB =
(SashForm)PriceElementWindow.getPriceEntityGrid().getParent( );
int[] weightsA = sashA.getWeights();
int[] weightsB = sashB.getWeights();
//disable screen updating
sashA.getShell().setRedraw(false);
PriceElement pe = (PriceElement)element;
PriceElementEditor.getForm().dispose();
try {
PriceElementEditor.setForm(new
PriceElementForm(sashA, SWT.NONE, pe));
sashA.setWeights(weightsA);
} catch (SQLException e) {
e.printStackTrace();
}
PriceElementWindow.getPriceEntityGrid().dispose();
PriceElementWindow.setPriceEntityGrid(new
PriceEntityGrid(sashB, SWT.VERTICAL, pe));
sashB.setWeights(weightsB);
//enable screen updating again
sashA.getShell().setRedraw(true);
}
});
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04554 seconds