How to define a custom dialog function
It allows you to specify your own dialog message function for any dialog. You can add additional features for standard dialogs. You can also specify a simple custom dialog function for the Next button. The custom dialog function is defined with the Dfunc variable, the Next dialog function is defined with the Dnextfunc variable.
The custom dialog function Dfunc
Look at an example of how to use Dfunc with the Setup Path dialog.
Step 1
Specify the name of your function as a value of Dfunc variable in 'Additional settings'. Notice! Your function names must end with cmdproc
Dfunc = mydlgpathcmdproc
Step 2
Add 'Source code' command at the beginning of the script. Check on 'External source code' checkbox. Insert the body of the function or a link to a gentee file with the function in 'Source code' parameter.
func uint mydlgpathcmdproc( uint wnd id ctl codedlg ) { switch id { case $DLGINIT : print("Init\n") case $IDC_PREV : print("Press Prev\n") case $IDC_NEXT : print("Press Next\n") } return dlgpathcmdproc( wnd, id, ctl, codedlg ) }
or
include : $"c:\my files\myfunc.g"
Don't forget to call a standard dialog message function from your function. The names and sources of standard functions can be found in cmds\sources subfolder of CreateInstall directory.
Define the Dnextfunc function which is invoked when the NEXT button is pressed.
Step 1
Specify the name of your function as a value of Dnextfunc variable in 'Additional settings'. Notice! Your function names must end with cmdproc
Dnextfunc = nextpathcmdproc
Step 2
Add 'Source code' command at the beginning of the script. Check on 'External source code' checkbox. Insert the body of the function or a link to a gentee file with the function in 'Source code' parameter. Also, you can insert the body of the function into some existing Source Code command with the checked "External Source Code".
The function has one parameter uint (the identifier of the window). The function must return 1 to continue the installation process or 0 to stay on the current dialog.
func uint nextpathcmdproc( uint wnd ) { str path macrox_getstr( "setuppath", path ) path.lower(); if path[0] != '0' { msg_warning( "Select the installation path on drive C:", "#lcaption#" ) return 0 } return 1 }