Coolbar repaint on application regaining focus (Win2K) [message #439830] |
Fri, 16 July 2004 13:52 |
Eclipse User |
|
|
|
Originally posted by: michaelraath.yahoo.co.uk
Apologies if this has been answered elsewhere, but if it has I have been
unable to find it.
I have added a label and combo to a coolbar, but have noticed that if I
tab away to another application and then return, the CoolItem is not
repainted correctly.
Can someone point out to me what I'm doing wrong, please? Any help is
greatly appreciated.
This demonstrates the problem:
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
CoolBar bar = new CoolBar(shell, SWT.NONE);
bar.setSize(200, 600);
CoolItem coolItem = new CoolItem(bar, SWT.NONE);
Composite quickSearch = new Composite(bar, SWT.NONE);
quickSearch.setLayout(new RowLayout());
Label qsLabel = new Label(quickSearch, SWT.CENTER);
qsLabel.setText("Search");
qsLabel.pack();
Combo dropDown = new Combo(quickSearch, SWT.DROP_DOWN);
dropDown.pack();
quickSearch.pack();
Point size = quickSearch.getSize();
coolItem.setControl(quickSearch);
coolItem.setPreferredSize(coolItem.computeSize(size.x, size.y));
shell.addFocusListener(new ACDMFocusListener(shell));
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (display.readAndDispatch())
display.sleep();
}
display.dispose();
}
|
|
|
|
|
Re: Coolbar repaint on application regaining focus (Win2K) [message #440004 is a reply to message #439830] |
Tue, 20 July 2004 13:16 |
Steve Northover Messages: 1636 Registered: July 2009 |
Senior Member |
|
|
The problem is your event loop. You are missing a "!" in front of
"display.readAndDispatch()". This causes you to sleep after every event.
"Mike Raath" <michaelraath@yahoo.co.uk> wrote in message
news:cd8mi4$gb6$1@eclipse.org...
> Apologies if this has been answered elsewhere, but if it has I have been
> unable to find it.
>
> I have added a label and combo to a coolbar, but have noticed that if I
> tab away to another application and then return, the CoolItem is not
> repainted correctly.
>
> Can someone point out to me what I'm doing wrong, please? Any help is
> greatly appreciated.
>
> This demonstrates the problem:
>
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
>
> CoolBar bar = new CoolBar(shell, SWT.NONE);
> bar.setSize(200, 600);
>
> CoolItem coolItem = new CoolItem(bar, SWT.NONE);
> Composite quickSearch = new Composite(bar, SWT.NONE);
> quickSearch.setLayout(new RowLayout());
>
> Label qsLabel = new Label(quickSearch, SWT.CENTER);
> qsLabel.setText("Search");
> qsLabel.pack();
>
> Combo dropDown = new Combo(quickSearch, SWT.DROP_DOWN);
> dropDown.pack();
> quickSearch.pack();
> Point size = quickSearch.getSize();
>
> coolItem.setControl(quickSearch);
> coolItem.setPreferredSize(coolItem.computeSize(size.x, size.y));
>
> shell.addFocusListener(new ACDMFocusListener(shell));
> shell.pack();
> shell.open();
>
> while (!shell.isDisposed()) {
> if (display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
>
> }
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03280 seconds