() Inno Setup entry (15th) -- Inno Setup class reference (1)

Source: Internet
Author: User

This article Reprinted from: http://blog.csdn.net/yushanddddfenghailin/article/details/17250955

The Nno setup script supports many classes, which greatly enhance the functions of the installer. By using these classes, many amazing installers will be created, next we will start learning the class.

Create custom Wizard Page

The custom Wizard Page needs to be created in the initializewizard event function. You can use the createcustompage function to create an empty page, or use createinput... page and createoutput... page and other functions to create pre-built pages, such as createinputdirpage, createinputfilepage, and createoutputprogresspage. After the page is created, you can add controls on the page. You can manually create controls or use special functions on the pre-created page. The first parameter of most of the create... page functions is usually the page ID, which specifies the existing page to which the newly created page is placed. There are several ways to obtain the page ID of an existing page. For example, a page created by a user has an ID attribute that is a read-only integer and its value is the page ID, the built-in Wizard Page has a predetermined ID. The available names are as follows:

Wpwelcome

Wplicense

Wppassword

Wpinfobefore

Wpuserinfo

Wpselectdir

Wpselectcomponents

Wpselectprogramgroup

Wpselecttasks

Wpready

Wppreparing

Wpinstalling

Wpinfoafter

Wpfinished

   

After the custom page is created, the installer will display the page and process it like the pre-created page. For example, call the nextbuttonclick and shouldskippage event functions associated with all pages.

The following is a prototype of the createcustompage function:

Function createcustompage (const afterid: integer; const acaption, adetion: string): twizardpage

The first parameter is the same as the previous page ID. You can use any of the preceding parameters as the parameter. The second parameter named "acaption" specifies the page title, which will be displayed at the top of the page, the third parameter is the description of the page. The Return Value of the function is a twizardpage class. According to the help document of Inno Setup, the prototype of this class is as follows:

Twizardpage = Class (tcomponent)

Property ID: integer; read;

Property caption: string; read write;

Property Description: string; read write;

Property Surface: tnewnotebookpage; read write;

Property surfaceheight: integer; read write;

Property surfacewidth: integer; read write;

Property onactivate: twizardpagenotifyevent; read write;

Property onbackbuttonclick: twizardpagebuttonevent; read write;

Property oncancelbuttonclick: twizardpagecancelevent; read write;

Property onnextbuttonclick: twizardpagebuttonevent; read write;

Property onshouldskippage: twizardpageshouldskipevent; read write;

End;

Twizardpagenotifyevent = procedure (Sender: twizardpage );

Twizardpagebuttonevent = function (Sender: twizardpage): Boolean;

Twizardpagecancelevent = procedure (Sender: twizardpage; var acancel, aconfirm: Boolean );

Twizardpageshouldskipevent = function (Sender: twizardpage): Boolean;

The following program will create a simple custom page and display it behind the welcome page:

[Setup]

Appname = test

Appvername = test

Defaultdirname = "E: \ test"

Appversion = 1.0

[Files]

Source: "F: \ Desktop \ test \ ipmsg.exe"; flags: dontcopy

[Code]

Procedure initializewizard ();

Begin

Createcustompage (wpwelcome, 'title: Custom page', 'description: This is my custom page ');

End;

After running, When you click the next button on the welcome page, the following page appears:

 

In addition, we also test the attributes of the createcustompage returned value twizardpage class. For example, the following example tests the ID and nextbuttonclick attributes:

[Code]

VaR

Mypage: twizardpage;

Mypageid: integer;

Function nextbuttonclick (curpageid: integer): Boolean;

Begin

If curpageid = mypageid then

Begin

If msgbox ('Are you sure you want to leave this page? ', Mbconfirmation, mb_yesno or mb_defbutton2) = idyes then result: = true;

End

Else

Result: = true;

End;

Procedure initializewizard ();

Begin

Mypage: = createcustompage (wpwelcome, 'title: Custom page', 'description: This is my custom page ');

Mypageid: = mypage. ID;

End;

Run the program. When you arrive at the custom page and click Next, the following confirmation dialog box appears:

 

Select "yes" to go to the next page. "No" will be left on this page.

Although the above page does not have any space, it is not easy to add various controls to the page after the page is successfully created. It is like after the foundation is completed, it is much easier to build a house.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.