Add-In: Date Parameter?

864
3
Jump to solution
04-12-2013 05:33 AM
JamesCrandall
MVP Frequent Contributor
So, I am a ArcObjects/COM developer (C#/VB/.NET) struggling to accept the restrictions that are being placed on my new role as a Python Add-In developer!!! 

As you can probably guess at this point, my frustration resides with the limited GUI capabilities that are offered for creating new and functional tools for ArcGIS 10.1 --- don't get me wrong, I've managed to build some really functional geoprocessing tools for ArcToolbox and will continue to do that.  But I am struggling to incorporate the mapping environment.

Anyway --- to my question:

How can I acquire two date parameters from the user via a Python Add-In?

I do not see any datetime pickers available.  No textbox controls that I could arm-twist into date values.  There's a ComboBox control, but useless for my need.

I was also under the impression that at ArcGIS 10.0 I could use VisualStudio Express to build an Add-In (not a Python Add-In), which would provide access to those GUI components I want!  Is this a viable option (I know it wouldn't be Python-based)?

Thanks for listening and thanks for any input!

J
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChrisFox3
Occasional Contributor III
Yes, one option would be to author a model or script tool that has 2 data-time parameters and based on use input executes some logic. Then from a button in your add-in you could launch that tool. GP Tools have 100's of parameter types that allow you to build a UI for accepting user input and built-in and customize-able validation that can be run before the tool is actually executed.

Another option would be to build a .Net add-in. The .Net framework offers a rich environment for building windows forms that can accept user input and execute code. If you would prefer to author your form in .Net you could still have you business logic in a python script tool and call the tool from .Net passing in any required parameters.

View solution in original post

0 Kudos
3 Replies
JamesCrandall
MVP Frequent Contributor
I see that we can arm-twist things with GPToolDialog(toolbox, tool_name) maybe. 

http://resources.arcgis.com/en/help/main/10.1/index.html#/The_pythonaddins_module/014p00000021000000...

j
0 Kudos
ChrisFox3
Occasional Contributor III
Yes, one option would be to author a model or script tool that has 2 data-time parameters and based on use input executes some logic. Then from a button in your add-in you could launch that tool. GP Tools have 100's of parameter types that allow you to build a UI for accepting user input and built-in and customize-able validation that can be run before the tool is actually executed.

Another option would be to build a .Net add-in. The .Net framework offers a rich environment for building windows forms that can accept user input and execute code. If you would prefer to author your form in .Net you could still have you business logic in a python script tool and call the tool from .Net passing in any required parameters.
0 Kudos
JamesCrandall
MVP Frequent Contributor
Yes, one option would be to author a model or script tool that has 2 data-time parameters and based on use input executes some logic. Then from a button in your add-in you could launch that tool. GP Tools have 100's of parameter types that allow you to build a UI for accepting user input and built-in and customize-able validation that can be run before the tool is actually executed.

Another option would be to build a .Net add-in. The .Net framework offers a rich environment for building windows forms that can accept user input and execute code. If you would prefer to author your form in .Net you could still have you business logic in a python script tool and call the tool from .Net passing in any required parameters.


Thanks, Chris --- yes, I have done just what you describe with launching Toolbox I created with GPToolDialog.  It seems a bit disconnected, but it works.  I had hoped to have a few more UI control elements available via the Python Add-In, but like you say I can implement a .NET add-in to accomplish this.  This is my area of familiarity (but with creating COM components) -- should be a nice change from having to build Setup.exe/.msi and dealing with installer issues!

James
0 Kudos