Hello,
As a user we want to show a OK / Cancel custom dialog box when closing Microstation. When click cancel, Microstation must remain opened.
We implemented this as fallows:
InputCallback::SetMonitorFunction(monitorFunction, InputMonitorFilter::MONITOR_ALL);
InputFilterReturnValue monitorFunction(Inputq_element* queueElementP) { if (queueElementP->u.cmd.command == CMD_EXIT || queueElementP->u.cmd.command == CMD_EXIT_NOUC || queueElementP->u.cmd.command == CMD_CLOSE_DESIGN ) { int res = MessageBox(NULL, L"Realy Close ?", L"Custom Addin", MB_OKCANCEL | MB_ICONQUESTION); if (res == CANCEL_BUTTON) { return INPUT_REJECT; } } return INPUT_ACCEPT; }
This works fine when the user exit Microstation with key in command (EXIT or QUIT) or main menu File -> Exit or File ->Close Design
BUT, this does not work when closing Microstation with sytem menu close icon (X icon). When user click the close icon, Microstation main window closes prematurely , the custom dialog box is showing and when the user click cancel, microstation.exe process is still running, but there is no Microstation window opened anymore. One must kill the process from task manager. When clicking OK, microstation.exe process is terminanted as expected.
Why this behavior is different than key in commands, are we missing Something in the code or is this a BUG or is there another way to implement this ?
Microstation Version : CONNECT Update 13
Microstation SDK : SDK Update 13
jmdsgcv said:When user click the close icon, Microstation main window closes prematurely
When I click the Windows Close box, I expect the app. to close. That is a well-established Windows idiom. I don't expect the app to pop a dialog to ask me if I really [note correct spelling] want to close the app.
You're violating the principle of least astonishment in software design. Are you going to modify Word, Excel etc. to show the same dialog?
Regards, Jon Summers LA Solutions
This is behaviour that seems to be new in Microstation Update 13 and is present in Update 14.
In larger models, there is a decent delay before the software actually closes which gets frustrating when things like Projectwise dialogs only appear with the "real" shutdown of Microstation.
You'll also see things like Element Selector stays open after the main window closes prematurely. This is defect if you ask me.
Regards,
Mark
OpenRoads Designer 2023 | Microstation 2023.2 | ProjectWise 2023
I would be agree with you, but, i did the following test and had same behaviour :
- in Mstn settings -> Préférences set "Auto-Save Design Changes" Off (unchecked)
- do some modifications on the design file
- close Mstn with system cross button
- in the dialog "Save design changes" click Cancel
I would expect that Mstn stays opened with the design file, but instead of this, the application window is closed and the microstation.exe process is still running with the design file locked.
I don't think this is a normal behaviour !
P.S. From the main menu : File -> Exit is working properly, the Mstn stays opened if one click Cancel in "save design changes" dialog box.
best regards,
JMD
jmdsgcv said: in the dialog "Save design changes" click Cancel I would expect that Mstn stays opened with the design file, but instead of this, the application window is closed and the microstation.exe process is still running with the design file locked
in the dialog "Save design changes" click Cancel
I would expect that Mstn stays opened with the design file, but instead of this, the application window is closed and the microstation.exe process is still running with the design file locked
That's a bug: post that question to the MicroStation Forum and/or file a trouble report (TR) with Bentley Systems. It's probably best to avoid writing code to get around bugs in MicroStation: if it's reproducible, then Bentley Systems should fix it.
FYI, we have just installed Mstn update 14 and in this version the problem is solved.
Answer Verified By: Robert Hook