Inno Setup入门(二十二)——Inno Setup类参考(8)
http://379910987.blog.163.com/blog/static/33523797201121331832201/
列表框
列表框(ListBox)是Windows应用程序中重要的输入手段,其中包括多个选项用户可以从其中选择一个或者多个,程序根据用户的选择做出相应的处理,列表框在外观上和存储框类似,但是行为却有很大的不同,列表框中项一般是预先给定的,而存储框则可以让用户进行输入,并且列表框中的项被选择之后也会触发事件。Pascal脚本中列表框的类由TlistBox实现,其定义如下:
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: TNotifyEvent; read write;
property OnDblClick: TNotifyEvent; read write;
property OnKeyDown: TKeyEvent; read write;
property OnKeyPress: TKeyPressEvent; read write;
property OnKeyUp: TKeyEvent; read write;
end;
层次模型如下:
下面的代码将演示列表框的使用:
[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:='你选择的城市是:'+list.Items.Strings[list.ItemIndex] end; procedure InitializeWizard(); begin myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面'); list:=TListBox.Create(myPage); list.Parent:=myPage.Surface; list.Items.Add('北京'); list.Items.Add('上海'); list.Items.Add('香港'); list.Items.Add('武汉'); list.Items.Add('广州'); list.OnClick:=@ClickListBox; lbl:=TLabel.Create(myPage); lbl.Parent:=myPage.Surface; lbl.Top:=list.Top+list.Height+10; end; |
list.ItemIndex返回列表框中选中项索引值,Items.Strings[list.ItemIndex]则是返回该索引值指代项的字符串值,安装页面如下:
另外,列表框也有MultiSelect选项,表示列表框是否支持多选(在支持的前提下,需要按Ctrl键),但是这种性能并不是太好,个人觉得这个时候还不如用多选框效果更好。
最新文章
- 【Django】--Form组件
- Go语言异常处理defer\panic\recover
- python不用加号实现加法
- Git command line
- C语言的内存管理
- 1.html5究竟是什么
- php整理(一):变量和字符串
- python实现的基于TCP的JSON数据通信
- etTimeout与setInterval方法的区别
- 结构性产品 Structured Product
- 条款20:宁以pass-by-reference-to-const替换pass-by-value
- 小米2s的座充,看看这个是什么芯片? - 电池&综合DIY(Flashlight Electronics-Batteries Include - 手电大家谈-手电筒爱好者之家
- gitbook 入门教程之 gitbook 简介
- Java8 LocalDateTime获取时间戳(毫秒/秒)、LocalDateTime与String互转、Date与LocalDateTime互转
- 微信小程序 从含有tabbar的页面跳转到不含有tabbar的页面
- enquire.js-响应css媒体查询的轻量级javascript库
- jdk中的简单并发,需要掌握
- Python中xlwt解析
- java中父进程与子进程
- for XX in XX结构
热门文章
- Educational Codeforces Round 23 补题小结
- UNIX shell 学习笔记 一 : 几个shell的规则语法对比
- AspxGridView 表中的ASPxHyperLink不导出到excel
- tornado 模版
- redis的安装和php的redis扩展
- _stdcall调用
- hdu 1026(优先队列+路径输出)
- Search in Rotated Sorted Array I&;&;II——二分法
- [BZOJ4456] [Zjoi2016]旅行者 分治+最短路
- react native 调用Android原生方法