Author Topic: Session.Prompt Dialog  (Read 3341 times)

philchudley

  • EA User
  • **
  • Posts: 743
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Session.Prompt Dialog
« 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
Models are great!
Correct models are even greater!

shimon

  • EA User
  • **
  • Posts: 162
  • Karma: +5/-0
    • View Profile
Re: Session.Prompt Dialog
« Reply #1 on: June 26, 2025, 03:04:12 pm »
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

philchudley

  • EA User
  • **
  • Posts: 743
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: Session.Prompt Dialog
« Reply #2 on: June 26, 2025, 07:36:21 pm »
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
Models are great!
Correct models are even greater!

Elpis

  • EA User
  • **
  • Posts: 47
  • Karma: +7/-0
  • Make MDA/MBSE vital.
    • View Profile
Re: Session.Prompt Dialog
« Reply #3 on: June 26, 2025, 09:07:50 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.

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.
« Last Edit: June 26, 2025, 09:10:25 pm by Elpis »

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13387
  • Karma: +566/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Session.Prompt Dialog
« Reply #4 on: June 26, 2025, 09:35:25 pm »
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

shimon

  • EA User
  • **
  • Posts: 162
  • Karma: +5/-0
    • View Profile
Re: Session.Prompt Dialog
« Reply #5 on: June 27, 2025, 01:21:48 am »
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.