#GPPT Creating Additional .Net Dialog Windows using Scripts

David Meego - Click for blog homepageOne of the current limitations for GP Power Tools is that it cannot create new Dexterity windows. Usually, it is possible to avoid this requirement by:

  • Using Modifier to add extra fields to an existing window;
  • Using the SQL Results window to display data with SQL Gotos to perform actions on that data;
  • Using Dexterity modal dialogs (ask() and getstring() for example) to get information needed;
  • Using Modifier even adding a complete “sub window” onto an existing window (example below).

This article provides another method leveraging the .Net Framework functionality to create a dynamic form using code.

Just to show one of the alternatives mentioned that you might not have seen before, below is an example of a “sub window” added to the Receivables Management Setup window:

The sample code in this article uses the System.Windows.Forms library in the .Net Framework to build a custom modal dialog. The objects included in the dialog can be modified to whatever is required for your customization.

The Project includes example code for a Dexterity getstring() dialog as well as the same .Net dialog created using Dexterity with the .Net Interop via the Runtime Execute Setup window, and using both C# and VB.Net via the .Net Execute Setup window.

The first script can be executed to show all four of the dialogs.

Below are screenshots of what the dialogs look like:

  • The Dexterity getstring() command allows for a single string field to be entered. It cannot be changed (other than selecting password mode to hide the entered characters) and will always match the company color theme.

  • The .Net Dialog can be created using Dexterity, C# or VB.Net. It can be made to support the company color theme (see note in Compatibility section below). The layout can be changed to include as many fields as desired.

Compatibility

This example code is dynamically creating a .Net WinForm and would not work on the web client as it only supports Dexterity forms.

The sample code also includes calls to the Helper Function MBS_CompanyColorGetRGB (MbsCompanyColorGetRgb for .Net) which is used to make the colors on the dialog match the Company Color theme in use. This Helper Function is only available on the upcoming Build 29 of GP Power Tools or later, so the line of code that calls it will need to be commented out for older versions to compile and the dialog will then use the standard .Net colors.

The project will need at least Build 28 to function properly as it uses the Memory based Parameter Helper Function calls that were added in that build.

The Future

The next build of Visual Studio Integration Toolkit will include functionality to allow for the creation of custom Dexterity forms. This functionality will allow a future build of GP Power Tools to create Dexterity based windows (which will be Web Client compatible). For now, this is the next best thing.

Downloading and Installing

Download the example code, import using the Project Setup window (now possible for first time imports with Build 28.8 onwards), or use Configuration Export/Import window (for older builds):

The code will be active on next login or after switching companies, or you can use start the triggers manually from the Project Setup window.

More Information

For more information see:

Enjoy

David

This article was originally posted on http://www.winthropdc.com/blog.

One thought on “#GPPT Creating Additional .Net Dialog Windows using Scripts

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.