Book a Demo

Author Topic: Diagram SelectedConnector only works from 2nd call  (Read 2938 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Diagram SelectedConnector only works from 2nd call
« on: February 11, 2021, 06:36:47 pm »
Hi,
I have a script that selects a connector on the diagram. When this is executed, nothing happens. It's only when it's called a second time that it works ok.
On the following JSript sample, I noticed that duplicating "currentDiagram.SelectedConnector = connector ;" fixes the issue.

It seems to be a bug.

Code: [Select]
function OnDiagramScript()
{
var currentDiagram as EA.Diagram;
currentDiagram = Repository.GetCurrentDiagram();
if ( currentDiagram != null )
{
var connector as EA.Connector;
connector = Repository.GetConnectorByID(48039);
currentDiagram.SelectedConnector = connector ;
}
}
OnDiagramScript();
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Diagram SelectedConnector only works from 2nd call
« Reply #1 on: February 11, 2021, 06:52:15 pm »
Hi Guillaume,

I can confirm that there is definitely something weird going on when selecting connectors in a diagram.

I use that in the EA navigator as well, and I noticed similar inconsistent behavior (sometimes it doesn't seem to work)
I might try setting the selected connector twice, if that solve the problem.

Geert

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Re: Diagram SelectedConnector only works from 2nd call
« Reply #2 on: February 11, 2021, 10:11:00 pm »
Hi Geert,

Thanks for the info. I reported it as a bug, even though the workaround of calling it twice works for me.

Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com