This article Reprinted from: http://blog.csdn.net/yushanddddfenghailin/article/details/17268435
Check box
The check box is used to make one or more choices among multiple options that are not mutually exclusive. For example, the font can contain bold, italic, and underline, and the three statuses can be combined at will, you can use check boxes for such options. The class corresponding to the Pascal script is tcheckbox, which is defined as follows: <xmlnamespace prefix = "O" NS = "urn: Schemas-Microsoft-com: Office: office"/>
Tcheckbox = Class (tcustomcheckbox)
Property alignment: talignment; read write;
Property allowgrayed: Boolean; read write;
Property caption: string; read write;
Property checked: Boolean; read write;
Property color: tcolor; read write;
Property Font: tfont; read write;
<Xmlnamespace prefix = "ST1" NS = "urn: Schemas-Microsoft-com: Office: smarttags"/> property state: tcheckboxstate; read write;
Property onclick: tpolicyevent; read write;
End;
The hierarchical model is as follows:
This analogy uses radiobox to inherit a tcustomcheckbox, which provides more functions. The following code demonstrates the use of the check box:
[Setup] Appname = test Appvername = test Defaultdirname = "E: \ test" Appversion = 1.0 [Files] Source: zzz. ISS; flags: dontcopy [Code] VaR Mypage: twizardpage; LBL: tlabel; Chk1, CHK2, chk3: tcheckbox; Procedure clickchk1 (Sender: tobject ); Begin If chk1.checked then LBL. Font. Style: = LBL. Font. Style + [fsbold] Else LBL. Font. Style: = LBL. Font. Style-[fsbold]; End; Procedure clickchk2 (Sender: tobject ); Begin If chk2.checked then LBL. Font. Style: = LBL. Font. Style + [fsitalic] Else LBL. Font. Style: = LBL. Font. Style-[fsitalic]; End; Procedure clickchk3 (Sender: tobject ); Begin If chk3.checked then LBL. Font. Style: = LBL. Font. Style + [fsunderline] Else LBL. Font. Style: = LBL. Font. Style-[fsunderline]; 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: = 'select the check box and pay attention to text variations '; Chk1: = tcheckbox. Create (mypage ); Chk1.parent: = mypage. surface; Chk1.caption: = 'bold '; Chk1.top: = LBL. Top + 20; Chk1.onclick: [email protected]; CHK2: = tcheckbox. Create (mypage ); Chk2.parent: = mypage. surface; Chk2.caption: = 'italic '; Chk2.top: = chk1.top + 20; Chk2.onclick: [email protected]; Chk3: = tcheckbox. Create (mypage ); Chk3.parent: = mypage. surface; Chk3.caption: = 'underline '; Chk3.top: = chk2.top + 20; Chk3.onclick: [email protected]; End; |
The program running effect is as follows:
In addition, the check box also has an important attribute "State", which specifies the appearance of the check box. It can have three values: cbunchecked, cbchecked, and cbgrayed, that is, no selection, no selection, and no determination, you can use the following code:
Chk1.state: = cbunchecked; Chk2.state: = cbchecked; Chk3.state: = cbgrayed; |
The effect is as follows: