VST Controls


DOWNLOAD REPOSITORY: https://1drv.ms/f/s!Apq0kJ8mZuF4hSZEYwSP1zb-i96s

Note : VST Control is currently a version 1.0 product. Your feedback on the product is very welcome. Suggested improvements will be incorporated into new releases. Please submit your details via the Contact Us page if you would like to be informed of new releases

VST Controls®™ for Dynamics GP

 

VST Controls®™  extends the power of Visual Studio Tools for Dynamics GP by allowing a .NET developer to add Windows Component Controls to any GP window.

 

This means Labels, Buttons, Combo-boxes, Grids, Browsers, Hyperlinks and even 3rd party controls can be added to a form with just a couple of lines of code.

 

All the properties, methods and events associated with the control are accessible and available to the developer

 

The 3 simple steps needed to add a control to a GP window are

 

         Add a reference to VSTControls.dll to your .NET project

         Create an object and set its properties and events

         Assign the object to a GP window

 

Let’s jump right in with a simple example

 

Example 1: Adding a label to a form

 

Add a reference to the VSTControls.dll  library

 

 

 

Create a VSTControls object

Create component object ie. Label component

Add the Label object to the VSTControls object, specifying the Window and location

 

public class GpAddin : IDexterityAddIn

{

    // Create VST Control object

    VstControls vstControls = new VstControls();

 

    public void Initialize()

    {

        try

        {

            // Create component object

            Label lblItemAvailability = new Label();

            lblItemAvailability.Text = "Availability";

            lblItemAvailability.AutoSize = true;

 

            // Add object to VST control, specifying the Window name, location and the object

            vstControls.Add(new VstControl("Item Maintenance", 12, 385, lblItemAvailability));

 

             

 

Example 2 : Add a TextBox

 

Create a TextBox object and add it to the Item Maintenance Window

Add an AfterLeave event to the ITEMNMBR field.

When the AfterLeave event is fired, read the ITEMNMBR value and set the font and text of the TextBox

based on the ITEMNMBR field value

 

public class GpAddin : IDexterityAddIn

{

    // Create VST Control object

    VstControls vstControls = new VstControls();

 

    static IvItemMaintenanceForm IvItemMaintenanceForm = Dynamics.Forms.IvItemMaintenance;

    static IvItemMaintenanceForm.IvItemMaintenanceWindow IvItemMaintenanceWindow

           = IvItemMaintenanceForm.IvItemMaintenance;

 

    PictureBox pictureBox = new PictureBox();

 

    public void Initialize()

    {

        // Add AfterLeave event to the ItemNmbr

        IvItemMaintenanceWindow.ItemNumber.LeaveAfterOriginal

          += new EventHandler(ItemNumber_LeaveAfterOriginal);

 

        pictureBox.Size = new System.Drawing.Size(80, 80);

        pictureBox.BorderStyle = BorderStyle.FixedSingle;

        pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;

        vstControls.Add(new VstControl("Item Maintenance", 520, 27, pictureBox));

    }

 

 

    void ItemNumber_LeaveAfterOriginal(object sender, EventArgs e)

    {

        if
            (IvItemMaintenanceWindow.ItemNumber == "128 SDRAM")

        {

            pictureBox.Image = (System.Drawing.Image)Resource.Memory;

        }

        else

        {

            pictureBox.Image = null;

        }

    }

}

 

 

 

 

 

Example 3 : Add pictures

 

Create a Picture object and add it to the Item Maintenance Window

Add an AfterLeave event to the ITEMNMBR field.

When the AfterLeave event is fired, read the ITEMNMBR value and set the image of the picture object

based on the ITEMNMBR field value

 

public class GpAddin : IDexterityAddIn

{

    // Create VST Control object

    VstControls vstControls = new VstControls();

 

    static IvItemMaintenanceForm IvItemMaintenanceForm = Dynamics.Forms.IvItemMaintenance;

    static IvItemMaintenanceForm.IvItemMaintenanceWindow IvItemMaintenanceWindow

    = IvItemMaintenanceForm.IvItemMaintenance;

 

    PictureBox pictureBox = new PictureBox();

 

    public void Initialize()

    {

        // Add AfterLeave event to the ItemNmbr

        IvItemMaintenanceWindow.ItemNumber.LeaveAfterOriginal

        += new EventHandler(ItemNumber_LeaveAfterOriginal);

 

        pictureBox.Size = new System.Drawing.Size(80, 80);

        pictureBox.BorderStyle = BorderStyle.FixedSingle;

        pictureBox.SizeMode = PictureBoxSizeMode.StretchImage;

        vstControls.Add(new VstControl("Item Maintenance", 520, 27, pictureBox));

    }

 

 

    void ItemNumber_LeaveAfterOriginal(object sender, EventArgs e)

    {

        if (IvItemMaintenanceWindow.ItemNumber == "128 SDRAM")

        {

            pictureBox.Image = (System.Drawing.Image)Resource.Memory;

        }

        else

        {

            pictureBox.Image = null;

        }

    }

}

 

 

 

 

Example 4 : UserControls

 

Finally, the VST Controls library can be used to develop utilities that improve the VST Control functionality

When adding an object to a GP window, the XY coordinates of the object must be specified. To assist with this, a UserControl called PositionLocator was developed and can be added to a GP Window via VST Controls.

 

Once the GP window is opened, the PositionLocator is displayed, along with the current cursor XY location

 

A developer can then use these XY coordinates when placing further objects onto a GP window

 

 

 

 

public class GpAddin : IDexterityAddIn

{

    // Create VST Control object

    VstControls vstControls = new VstControls();

 

    public void Initialize()

    {

        // Add a UserControl that can read the cursor location

        PositionLocator positionLocator = new PositionLocator();

        vstControls.Add(new VstControl("Item Maintenance", Position.Left, positionLocator))

    }

}

 

 

.