I would like to set the cursor to wait cursor. In ArcObjects, this works as follows:
IMouseCursor mouseCursor = new MouseCursorClass();
mouseCursor.SetCursor(2); // Wait cursor
When I use the wait cursor from System.Windows.Forms, it turns back to default cursor as soon as I move the mouse:
Cursor.Current = Cursors.WaitCursor;
Is there a good way to do this in ArcGIS Pro?
Solved! Go to Solution.
Not sure if this would work for you, but perhaps you could put in a Progress Dialog.
var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel");
progDlg.Show();
var progSrc = new CancelableProgressorSource(progDlg);
If you are developing a custom tool in Pro, here is a code snippet to modify the tool's cursor:
Hello Uma,
thank you for your reply! I am not developing a custom tool. I run some calculations that last several seconds or minutes, and I want to show the user that she/he has to wait. With ArcObjects (using IMouseCursor), this worked perfect.
Not sure if this would work for you, but perhaps you could put in a Progress Dialog.
var progDlg = new ProgressDialog("Running Geoprocessing Tool", "Cancel");
progDlg.Show();
var progSrc = new CancelableProgressorSource(progDlg);
This is exactly what I am looking for.
If you are trying to do this in Code for a Add-In, to set the wait cursor for the Application while waiting for a long running process to complete use the following:
FrameworkApplication.Current.MainWindow.Cursor = System.Windows.Input.Cursors.Wait;
Application.UseWaitCursor = true;
frmLoading.Show(); <--this is just a simple form telling the user Why they are waiting.
MyrLongRunningProcess();
frmLoading.Close();
Application.UseWaitCursor = false;
FrameworkApplication.Current.MainWindow.Cursor = System.Windows.Input.Cursors.Arrow;