(Switch) Inno Setup entry (22) -- Inno Setup class reference (8)

Source: Internet
Author: User

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

List box

ListBox is an important input method in Windows applications. It includes multiple options. You can select one or more options, and the program processes the selected items accordingly, the appearance of a list box is similar to that of a storage box, but its behavior is very different. items in the list box are generally pre-defined, while the storage box allows users to input, when an item in the list box is selected, an event is triggered. The ListBox class in the Pascal script is implemented by tlistbox. Its definition is as follows:

Tlistbox = Class (tcustomlistbox)

Property borderstyle: tborderstyle; read write;

Property color: tcolor; read write;

Property Font: tfont; read write;

Property multiselect: Boolean; read write;

Property sorted: Boolean; read write;

Property style: tlistboxstyle; read write;

Property onclick: tpolicyevent; read write;

Property ondblclick: tpolicyevent; read write;

Property onkeydown: tkeyevent; read write;

Property onkeypress: tkeypressevent; read write;

Property onkeyup: tkeyevent; read write;

End;

The hierarchical model is as follows:

 

The following code demonstrates the use of the list box:

[Setup]

Appname = test

Appvername = test

Defaultdirname = "E: \ test"

Appversion = 1.0

 

[Files]

Source: zzz. ISS; flags: dontcopy

 

[Code]

VaR

Mypage: twizardpage;

List: tlistbox;

LBL: tlabel;

 

Procedure clicklistbox (Sender: tobject );

Begin

LBL. Caption: = 'The city you selected is: '+ list. Items. Strings [list. itemindex]

End;

 

Procedure initializewizard ();

Begin

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

List: = tlistbox. Create (mypage );

List. Parent: = mypage. surface;

List. Items. Add ('beijing ');

List. Items. Add ('shanghai ');

List. Items. Add ('Hong Kong ');

List. Items. Add ('wuhan ');

List. Items. Add ('guangzhou ');

List. onclick: [email protected];

LBL: = tlabel. Create (mypage );

LBL. Parent: = mypage. surface;

LBL. Top: = List. Top + list. height + 10;

End;

List. itemindex: return the index value of the selected item in the list box. Items. Strings [list. itemindex] indicates the string value of the item. The installation page is as follows:

 

In addition, the list box also has the multiselect option, indicating whether the list box supports multiple selections (press Ctrl when supported), but this performance is not very good, I personally think it is better to use multiple selection boxes at this time.

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.