2021-08-23 11:31 PM - last edited on 2021-09-14 09:19 AM by Noemi Balogh
2021-09-07 10:08 AM
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.