EN RU
Log in
Home
Download
Purchase
Documentation
Support
Contact us
 
Help  /  FAQ

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
}

 

See also

  • Example of use of the dialog function
  • Variables of dialogs
Eonza automation software - free, open source cross-platform program for easy creation and management of scripts.
  • Help
    • Introduction
    • Get to know CreateInstall
    • Compare installers
    • License Agreement
    • License Light
    • License Free
    • Program features
    • Command Reference
    • FAQ
      • Antivirus false positives
      • Command Prompt Mode
      • How to create shortcuts
      • How to get Control ID
      • How to sign an installation
      • How to use environment variables
      • Installing 64-bit applications
      • Local variables
      • Portable version
      • Unpacking filter
      • Common dialog parameters
      • Custom dialog function
      • Global variables
      • How to move and resize controls
      • How to use If Condition
      • Language-dependent variables
      • Multi build setups
      • Predefined folders
      • Predefined variables
      • Variables of dialogs
    • Examples & tips
    • CreateInstall Assistant
    • Problem solving
    • Setup Extractor
Copyright © Novostrim, OOO, 2009-2026 All rights reserved.