Book a Demo

Author Topic: create a form that is centered relative to EA window  (Read 2094 times)

bakawakalaka

  • EA Novice
  • *
  • Posts: 9
  • Karma: +0/-1
    • View Profile
create a form that is centered relative to EA window
« on: May 24, 2019, 11:07:02 pm »
Hi, I created Add-in that show form with some data. I want this form shown in the center of EA winodws, but I can't find any information of how to do it. Is there any way to do so?

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: create a form that is centered relative to EA window
« Reply #1 on: May 24, 2019, 11:14:59 pm »
Yes you can.

You have to pass the main window of EA as parent in the operation ShowDialog()

usage:

Code: [Select]
        private void startImportMapping()
        {
            var importDialog = new ImportMappingForm();
            var selectedElement = this.model.selectedElement as TSF_EA.Element;
            if (selectedElement is UML.Classes.Kernel.Class
                || selectedElement is UML.Classes.Kernel.Package)
            {
                importDialog.sourcePathElement = selectedElement;
                importDialog.targetPathElement = this.findTarget(selectedElement);
            }
            importDialog.ImportButtonClicked += this.importMapping;
            importDialog.SourcePathBrowseButtonClicked += this.browseSourcePath;
            importDialog.TargetPathBrowseButtonClicked += this.browseTargetPath;
            importDialog.ShowDialog(this.model.mainEAWindow);
        }

for the property mainEAWindow see https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework/blob/master/EAAddinFramework/EAWrappers/Model.cs

Geert