Community
Participate
Working Groups
1. Import and run the test class below. 2. Execute menu item Test-->Run Test 1. Keep cursor in the window. Notice that a busy cursor is displayed. 3. Execute menu item Test-->Run Test 2. Keep cursor in the window. Notice that a busy cursor is NOT displayed. If you use the setCursor API, BusyIndicator.showWhile no longer works for some reason. import org.eclipse.swt.*; import org.eclipse.swt.events.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; /** */ public class TestViewer implements DisposeListener{ Shell shell; Cursor ibeamCursor = null; Composite widget; public static void main (String [] args) { TestViewer example = new TestViewer (); example.open (); example.run (); example.close (); } public void close () { if (shell != null && !shell.isDisposed ()) shell.dispose (); } void createMenuBar () { Menu bar = new Menu (shell, SWT.BAR); shell.setMenuBar (bar); MenuItem item = new MenuItem (bar, SWT.CASCADE); item.setText ("Test"); item.setMenu (createTestMenu ()); } void createShell () { shell = new Shell (); shell.setText ("Test"); GridLayout layout = new GridLayout(); layout.numColumns = 1; shell.setSize(500, 400); shell.setLayout(layout); } Menu createTestMenu() { Menu bar = shell.getMenuBar (); Menu menu = new Menu (bar); MenuItem item; item = new MenuItem (menu, SWT.CASCADE); item.setText ("Run Test 1"); item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { runTest1(); } }); item = new MenuItem (menu, SWT.CASCADE); item.setText ("Run Test 2"); item.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent event) { runTest2(); } }); return menu; } void createComposite() { widget = new Composite (shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); GridData spec = new GridData(); spec.horizontalAlignment = spec.FILL; spec.grabExcessHorizontalSpace = true; spec.verticalAlignment = spec.FILL; spec.grabExcessVerticalSpace = true; widget.setLayoutData(spec); } void runTest2() { ibeamCursor = new Cursor(shell.getDisplay(), SWT.CURSOR_IBEAM); widget.setCursor(ibeamCursor); Runnable r = new Runnable() { public void run() { try { Thread.sleep(3000); } catch (Exception e) {} } }; BusyIndicator.showWhile(shell.getDisplay(), r); } void runTest1() { widget.setCursor(null); Runnable r = new Runnable() { public void run() { try { Thread.sleep(3000); } catch (Exception e) {} } }; BusyIndicator.showWhile(shell.getDisplay(), r); } public void open () { createShell (); createMenuBar (); createComposite (); shell.open (); } public void run () { Display display = shell.getDisplay (); while (!shell.isDisposed ()) if (!display.readAndDispatch ()) display.sleep (); } public void widgetDisposed (DisposeEvent event) { if (ibeamCursor != null) ibeamCursor.dispose(); } } NOTES: LK (7/16/01 3:49:50 PM) This is why StyledText does not display a busy cursor properly. See: PR 1GEK10Y: SWT:WIN2000 - StyledText - No busy cursor McQ (17/07/2001 9:03:44 AM) - I find that surprising, since I see an "i beam" cursor when I'm over the widget. Prsesumably, you are setting this cursor. LK (7/17/01 10:16:48 AM) Yes we are setting the cursor, but why should that matter? Shouldn't BusyIndicator.showWhile work regardless of what the cursor may be at the time? Maybe I don't understand the rules about using the BusyIndicator.
Need to get SN to look at this.
PRODUCT VERSION: 0.125
SN should comment on the situation in this PR or one of the duplicate versions of it. Also, please search for all duplicates and link them together.
*** Bug 16783 has been marked as a duplicate of this bug. ***
*** Bug 19760 has been marked as a duplicate of this bug. ***
*** Bug 18247 has been marked as a duplicate of this bug. ***
*** This bug has been marked as a duplicate of 6325 ***