Archicad C++ API
About Archicad add-on development using the C++ API.

Modal Dialogs

poco2013
Mentor
I am trying to create Modal Dialogs programmatically in a Add-On and I can not find a example to follow. All of the examples in DG-Test use the grc resource.

Can anyone supply,or point me to, a example of creating a Modal Dialog from scratch stating with DGBLANKMODALDIALOG and building from there?? Just simple Buttons and Text Edit Boxes.

I'm having particular trouble with the CallBack.
Gerry

Windows 11 - Visual Studio 2022; ArchiCAD 27
1 REPLY 1
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Gerry,

The DG module of Graphisoft has an old deprecated C interface and a newer C++ interface.
Using the old C interface you have to define callbacks and handle each event. It seems you're struggling with that...
I recommend you to use the C++ interface. It's much more easier, just simply inherit your class from DG::ModalDialog base class. If you want to handle an event (for example button click), then override the corresponding virtual function.
There is a very simple Modal dialog example at our blog. I recommend you to start with that.
There is also a little more complex example at our blog, the Archicad Maze Generator dialog.