Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: philchudley on November 08, 2023, 11:34:08 pm
-
I am playing around with Model based add-ins using EA version 16.11.1627 64bit
Just, for the moment a simple menu to display an About box. The About box is displayed using Session.Prompt
This works fine, except that EA appears to hang with OK is clicked with the "blue circle of death" and will eventually (after about 45 secs to 1 minute) close the dialog.
Anyone else experienced this? If so, did you find a solution?
I suppose the delay does give the user time to read the dialog. ;)
Phil
-
Hi,
I also experienced a lot of "hanging" in the example. I'll check again to see if it is related to the Prompt dialog.
I was wondering if the Add-in could be exported and used as-is in another model.
Shimon
-
Hi Shimon
This topic come up in another thread and a solution (workaround) was posted by Guillaume:
Use this piece JavaScript in an operation within you model based add-in Class :
// 0 -> OK button
// 1 -> OK/Cancel buttons
// 3 -> Yes/No/Cancel buttons
// 4 -> Yes/No buttons
// Returns a value matching the clicked button:
// 1 -> OK
// 2 -> Cancel
// 6 -> Yes
// 7 -> No
style += 4096;
var WSH = new COMObject("WScript.Shell");
return WSH.Popup(prompt, 0, title, style);
I have tried it and it works perfectly! With the advantage of displaying text of your choice in the dialog title bar :)
Phil
-
I am playing around with Model based add-ins using EA version 16.11.1627 64bit
Just, for the moment a simple menu to display an About box. The About box is displayed using Session.Prompt
This works fine, except that EA appears to hang with OK is clicked with the "blue circle of death" and will eventually (after about 45 secs to 1 minute) close the dialog.
Try to upgrade to EA 17.0. Handling of Session.Prompt popup windows is better there.
In EA 16 I had experienced many issues with the window, including it being often hidden below main EA window, but modal, which rendered EA itself as "not responding" (until script engine timeout).
In EA 17 the addin 'Prompt' window is visible in Windows Task bar, so can be re-shown (brought to top) easylly.
-
Oh, yeah, I had my share of "pop-under" dialogs that make it look like EA is not responding.
I sometimes feel like it happens more with Remote Desktop installation (running as published app) then with local EA installations.
Geert
-
Hi Shimon
This topic come up in another thread and a solution (workaround) was posted by Guillaume:
Use this piece JavaScript in an operation within you model based add-in Class :
// 0 -> OK button
// 1 -> OK/Cancel buttons
// 3 -> Yes/No/Cancel buttons
// 4 -> Yes/No buttons
// Returns a value matching the clicked button:
// 1 -> OK
// 2 -> Cancel
// 6 -> Yes
// 7 -> No
style += 4096;
var WSH = new COMObject("WScript.Shell");
return WSH.Popup(prompt, 0, title, style);
I have tried it and it works perfectly! With the advantage of displaying text of your choice in the dialog title bar :)
Phil
Thanks Phil.
I've tried it too, but still had failures. Perplexity (or was it Copilot) suggested adding ( to Guillaume's solution) an if else statement to check it you have the WSH.Popup function, else use Session.prompt. This solved the problem for me.