V10 ResourcesGuides
ResourcesGuides
Guides
Back | List of Articles

How to open a user form from a PEX project?

Last changed in 02/12/2020

User Forms (UDF) are forms developed within the scope of extensibility projects and that allow you to extend the PRIMAVERA solution in a more integrated way because these forms are displayed directly inside the Shell (MDI), with the same aspect of the native ERP forms and also provide direct access to the context of the application (Modules and Platform).

To learn how to create a user form, check the "How to Create User Forms With Visual Studio?"

Up to version 10 these forms were only accessible through the application menus (using the concept of User Menus), from the Explorer (by creating shortcuts for application menus) or from the VBA project using the objects provided by the PRIMAVERA Platform.

With version 10, it is now also possible to call them directly from code in the application. To do this, simply instantiate the user form from the CreateCustomFormInstance method.

using Primavera.Extensibility.Base.Editors;
using Primavera.Extensibility.BusinessEntities.ExtensibilityService.EventArgs;
using Primavera.Extensibility.Extensions;

namespace ExtensibilitySample.Base
{
    public class UiFichaArtigos : FichaArtigos
    {
        public override void TeclaPressionada(int KeyCode, int Shift, ExtensibilityEventArgs e)
        {
            base.TeclaPressionada(KeyCode, Shift, e);

            using (var instance = this.BSO.Extensibility.CreateCustomFormInstance(typeof(MyUserForm)))
            {
                if (instance.IsSuccess())
                {
                    (instance.Result as MyUserForm).Show();
                }
            }
        }
    }
}
Bookmark or share this article
Esta página foi útil?
Obrigado pelo seu voto.

login para deixar a sua opinião.

Obrigado pelo seu feedback. Iremos analisá-lo para continuarmos a melhorar!
Related Articles
Getting Started How to create an integration project with Visual Studio? How to create an Interface Extensibility Project (PEX) with Visual Studio? How to create an API (Engine) extensibility project with Visual Studio? How to create user tabs with Visual Studio?