2

I'm using this statement in an add in to update the first pane of the ArcMap 10 statusbar:

ArcMap.Application.StatusBar.set_Message(0, message);

When the method is called, no exceptions are raised. In my OnClick method, I display a message box and when that occurs, I do see the text of the last message. It seems like the pane needs to be refreshed, but I don't see a method that does that.

I tried:

 ArcMap.Application.RefreshWindow();

but that doesn't help.

3 Answers 3

4

Try adding a Application.DoEvents, the STA thread probably don't have time to consume events. An other way would be to create a background worker thread that does your work, that would free the STA thread to process the event loop.

0

I am using StatusBar messages to inform the user of progress during a long piece of processing. My messages were not being displayed, except if a message box was also created.

The suggestion of MathiasWestin works well. Tested Arc10.3.1 Desktop with VB.Net The code is of the form My.ArcMap.Application.StatusBar.Message(0) = EditorMessage Application.DoEvents()

Note that the ArcMap application and the Application are different. I also tried using system.threading.thread.sleep to add a 100msec delay. This did not work, longer times would then become noticible by users.

Using Application.DoEvents also seems to help when changing mouse cursors. The ESRI.FrameWork.MouseCursor mouse cursor is defined: Dim pMouseCursor As MouseCursor = New MouseCursor '

I have found that the mouse cursor reverts to the standard pointer after geoprocessing jobs. Setting it again to a wait cursor using: pMouseCursor.SetCursor(2) ' 2 is wait cursor sometimes did not work. Adding a DoEvents made the switching of the mouse cursor more reliable.

-1

Untested suggestion: instead of passing 0, try ArcMap.Application.hWnd.

2
  • I tried this, but it does not work and you are likely to get an ArgumentException (does not fall within expected range).
    – Preston
    Commented Jan 13, 2017 at 3:41
  • The value 0 is the integer value of the esriStatusBarPanes.esriStatusMain enum value which is the "Leftmost pane where application messages are displayed."
    – Preston
    Commented Jan 13, 2017 at 3:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.