Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have an ArcGIS custom IGPFunction tool. I want to use the GP progress dialog not the progress bar at the bottom of the ArcGIS window as I don't want people to interact with the map whilst it's processing.

In the Execute method you have an instance of ITrackCancel but I can't work out how to show the default GP progress dialog from there. I have this as code at the moment but it still doesn't show the dialog. Any ideas?

        IStepProgressor pStepPro = (IStepProgressor)TrackCancel;
        pStepPro.MinRange = 0;
        pStepPro.StepValue = 1;
        pStepPro.Message = "Starting Import...";
        pStepPro.Position = 0;
        pStepPro.Show();

        ...

        pStepPro.Hide();

Thanks Rob

share|improve this question
    
+1 - I'd like to know the answer to this, as well. Currently, I implement a backgroundworker and disable certain buttons in a winform with little way to display any sort of tool progress. When the tool can take over an hour, it would be great to show the normal progress dialog. I wonder if an answer could be extended to standalone tools. –  Nathanus Dec 20 '11 at 17:10

1 Answer 1

up vote 1 down vote accepted

This is built-in to the Geoprocessing framework. If you have background processing turned on, you shouldn't block the UI. At all. It violates the principles of Geoprocessing -- what if you run the tool as a scheduled task, or in modelbuilder, or from Python?

If you absolutely HAVE to, two things:

I recommend checking if you're in a desktop application before bringing up a dialog by trying to create the AppRef class first -- if that fails, don't pop up a dialog.

But really, you shouldn't be second-guessing the user's preference for background/foreground processing. I'll assume in good faith you really do need this.

share|improve this answer
    
Yes I do need to do this. The progress dialog doesn't work for me, nothing displays. Strangely IGPUtilities2:InApplication is returning false. Even though it's being run from ArcToolbox. –  Rob Jan 11 '12 at 8:49
    
Wow, that sounds like a broken install to me. –  Jason Scheirer Jan 11 '12 at 16:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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