Wait cursor behind Dialog instead of default cursor

Add-in Express™ Support Service
That's what is more important than anything else

Wait cursor behind Dialog instead of default cursor
 
Brian Nesbitt


Guest


Before I display any of my Dialogs from my Excel add in I need to check if the user is currently editing to prevent some exceptions that can occur if they are editing.

I am using the information provided here http://www.add-in-express.com/creating-addins-blog/2011/03/23/excel-check-user-edit-cell/

The functionality works here, but when the dialog is opened and you move the cursor off the dialog but still over Excel you get a Waiting cursor. This makes a user think they shouldn't do anything and wait for the app to be responsive, when in fact the dialog is not actually waiting. The cursor on the Dialog is ok.


if (ExcelApp.Interactive)
{
   try
   {
      ExcelApp.Interactive = false;
      ExcelApp.Interactive = true;
   }
   catch (Exception)
   {
      return;
   }
}

new MyDialogShowDialog();


Incidentally it seems that the 2007+ solution on that page doesn't affect the cursor.
Posted 23 Sep, 2013 16:46:33 Top
nwein




Posts: 577
Joined: 2011-03-28
Have you tried Stuart's solution in the link you've provided (one of the last comments)?
i.e.:
if (ExcelApp.Interactive) 
{ 
   try 
   { 
      XlMousePointer mp = ExcelApp.Cursor;
      ExcelApp.Interactive = false; 
      ExcelApp.Interactive = true; 
	  ExcelApp.Cursor = mp;
   } 
   catch (Exception) 
   { 
      return; 
   } 
} 
 
new MyDialogShowDialog(); 
Posted 23 Sep, 2013 17:53:57 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Brian and Nir,

Brian, please try to use the code provided by Stuart. I think it should solve the issue with cursor.

Nir, thank you!
Posted 24 Sep, 2013 06:26:54 Top
Brian Nesbitt


Guest


Thanks. Yes that worked.

However, there seems to be other places in my add in that cause the wait cursor. Seems like if you add sheets or do something to excel while the dialog is open the wait cursor is used over Excel. Do you guys have a list or know of a few things that would cause this?

Seems like I might have to wrap this stuff in a "cursor transaction".
Posted 24 Sep, 2013 08:10:21 Top
Brian Nesbitt


Guest


It seems I just need to wrap a few more places with a Cursor transaction and this issue goes away. Thanks!
Posted 24 Sep, 2013 09:53:49 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Brian,

Thank you for good news and good luck with your project!
Posted 24 Sep, 2013 10:53:28 Top