Inno Setup entry (19th) -- Inno Setup class reference (5)

Source: Internet
Author: User

Radio button

Single-choice buttons are also common during installation, such as the sameProgramYou can choose to install different features, such32Bit or64The two are exclusive, so you can use the single-choice button (Radiobutton). The radio buttons placed in the same container are automatically exclusive,PascalThe single-choice buttons in the script are defined as follows:

Tradiobutton = Class (tbuttoncontrol)

Property alignment: talignment; read write;

Property caption: string; read write;

Property checked: Boolean; read write;

Property color: tcolor; read write;

Property Font: tfont; read write;

Property onclick: tpolicyevent; read write;

Property ondblclick: tpolicyevent; read write;

End;

Its Inheritance relationships include:

 

 

Visible and button-level models are the same. In fact,RadiobuttonAndButtonThere is no big difference. The only difference is that single-choice buttons are exclusive.

The followingCodeA text box and two radio buttons will be added to the custom Wizard Page:

 

[Setup]

Appname = test

Appvername = test

Defaultdirname = "E: \ test"

Appversion = 1.0

[Files]

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

[Code]

VaR

Mypage: twizardpage;

Radio1, Radio2: tradiobutton;

LBL: tlabel;

Font: tfont;

{Radio1Event Response Process}

Procedure clickradio1 (Sender: tobject );

Begin

LBL. Font. Color: = clred;

End;

{Radio2Event Response Process}

Procedure clickradio2 (Sender: tobject );

Begin

LBL. Font. Color: = clblue;

End;

Procedure initializewizard ();

Begin

Mypage: = createcustompage (wpwelcome ,'Title: Custom page','Description: This is my custom page.');

LBL: = tlabel. Create (mypage );

LBL. Parent: = mypage. surface;

LBL. Caption: ='Change the option of the single-choice button and I will change the color.';

Radio1: = tradiobutton. Create (mypage );

Radio1.parent: = mypage. surface;

Radio1.caption: ='Red';

Radio1.top: = LBL. Top + 20;

Font: = tfont. Create ();

Font. Color: = clred;

Radio1.font: = font;

Radio1.onclick: = @ clickradio1;

Radio2: = tradiobutton. Create (mypage );

Radio2.parent: = mypage. surface;

Radio2.caption: ='Blue';

Radio2.top: = radio1.top + 20;

Font. Color: = clblue;

Radio2.font: = font;

Radio2.onclick :=@ clickradio2;

End;

 

In this section of code, the emphasis is on single-choice buttons.OnclickEvent. The process in which this attribute points determines the behavior of clicking the single-choice button. After the installation file runs on the custom page, the effect is as follows:

Some may ask how to make a choice among multiple sets of different options? For example, how does one select a color and the font size? TraditionallyDelphiYes by adding a control classTgroupboxBut this class isPascalThe script is not supported, soDelphiThe method in does not work. Although the traditional method does not work, it does not meanInnoThere is nothing to do. The simplest way is to create two pages, one for processing one option, and the other for processing another option (so it is not very good to use the previous example here, it is mainly used to describe the use of single-choice buttons). After all the users have selected them, they will execute them in a unified manner. Another method is to use other controls, such as the list box (ListBox).

 

from: http://www.360doc.com/content/13/0327/14/4221543_274241050.shtml

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.