2024-12-13 01:52 AM
I am programming a c++ add-on using ArchiCAD27API + Visual Studio 2019 + Windows 10.
When I press the Enter key or ESC key in the Modai Dialog, the dialog closes.
Please tell me how to stop it from closing
2024-12-16 01:58 PM
Use the PanelCloseRequested of the PanelObserver.
See the AddRenameViewPointItemDialog.cpp of Navigator_Test example.
2024-12-25 12:49 AM
Thank you for your reply.
My program uses DGModalDialog() and I can't perform the processing you suggested.
If you know of any other ways, please let me know.
2024-12-25 05:56 AM
There is DG_MSG_CLOSEREQUEST message.
But unfortunately, it is not documetnted. I use C++ dialogs, and i dont know any details, sorry.
3 weeks ago
Thank you.
I try DG_MSG_CLOSEREQUEST.
11 hours ago - last edited 10 hours ago
You use a C-style dialog if I am correct.
In C-style dialogs the DG_MSG_CLOSEREQUEST is not used.
When you click the Ok or Cancel button or pess Esc/Enter, a DG_MSG_CLICK message is sent. If you return a 0 value in response of this message then the dialog will not be closed.
In general the dialog handler returns the button identifier for Ok/Cancel which enables the dialog to close, but you can return 0 to prevent closing the dialog:
case DG_MSG_CLICK:
switch (itemId) {
case DG_OK:
case DG_CANCEL:
if (doNotCloseDialog) {
return 0;
}
return itemId;
case AnyOtherButton:
...
return 0;
An other approach could be to use the DGRegisterHotKey function to steal the Esc/Enter keyboard events and not allow them to be processed by the dialog. In this case the dialog will accept the click events on the Ok/Cancel button but refuse to respond to the Enter/Esc keys.