Choose your top Archicad wishes!

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

Is it possible to change size of Modal Dialog in real-time or in constructor of dialog class.

Not applicable
Unfortunately, the event arrives only if the mouse is over control, at least it works like that for me
Miklos Vegh

When the dialog is already open you can change its size easily on a button click or an other event.


In construction time it is a bit complicated. Why? When a dialog is closed the Dialog Manager (DG) saves its position and size in the registry. Next time the dialog is opened, the coordinate and size is restored by the Dialog Manager.

In general the order of the dialog opening process is the following:

1. The dialog is constructed by the dialog constructor in the application code.

2. The dialog.Invoke() is called by the application.

3. DG calls the PanelOpened notification where the controls are initialized by the dialog code.

4. DG restores the dialog pos and size from the registry and calls the PanelResized notifications.

5. Other dialog events begin to be processed.


So the dialog geometry set inside the PanelOpened notification will be overridden with the sizes stored in the registry.


If you want to set custom size and position right after the dialog is constructed you should apply some trick with the PanelIdle notification. (PanelIdle event should be enabled). It arrives continuously when the dialog is in the idle state.

When the first PanelIdle event arrives you can set the dialog geometry and set a flag to do it only once.