Inno Setup入门(二十五)——Inno Setup类参考(11)

今天说说TNewCheckListBox类。
该类和ListBox差不多,只是下面的项可以用CheckBox或者RadioButton选择,是一种比较复杂的类型。

该类继承自 TCustomListBox,自身具有以下属性和函数: 
TNewCheckListBox = class(TCustomListBox)
  function AddCheckBox(const ACaption, ASubItem: String; ALevel: Byte; AChecked, AEnabled, AHasInternalChildren, ACheckWhenParentChecked: Boolean; AObject: TObject): Integer;
  function AddGroup(ACaption, ASubItem: String; ALevel: Byte; AObject: TObject): Integer;
  function AddRadioButton(const ACaption, ASubItem: String; ALevel: Byte; AChecked, AEnabled: Boolean; AObject: TObject): Integer;
  function CheckItem(const Index: Integer; const AOperation: TCheckItemOperation): Boolean;
  property Checked[Index: Integer]: Boolean; read write;
  property State[Index: Integer]: TCheckBoxState; read write;
  property ItemCaption[Index: Integer]: String; read write;
  property ItemEnabled[Index: Integer]: Boolean; read write;
  property ItemLevel[Index: Integer]: Byte; read;
  property ItemObject[Index: Integer]: TObject; read write;
  property ItemSubItem[Index: Integer]: String; read write;
  property AllowGrayed: Boolean; read write;
  property Flat: Boolean; read write;
  property MinItemHeight: Integer; read write;
  property Offset: Integer; read write;
  property OnClickCheck: TNotifyEvent; read write;
  property BorderStyle: TBorderStyle; read write;
  property Color: TColor; read write;
  property Font: TFont; read write;
  property Sorted: Boolean; 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;
  property ShowLines: Boolean; read write;
  property WantTabs: Boolean; read write;
  property RequireRadioSelection: Boolean; read write;
end


测试例子:

[code]
var
myPage:TWizardPage;
    clb1, clb2: TNewCheckListBox;
    lbl: TLabel;
    i,index:Integer;

procedure clbClickCheck(Sender: TObject);
begin
  lbl.Caption:='';
  for i:=1 to 3 do
    if clb1.Checked[i] then
        lbl.Caption:=clb1.ItemCaption[i]+'  '; 
        
    for i:=5 to 7 do
        if clb1.Checked[i] then
            lbl.Caption:=lbl.Caption+clb1.ItemCaption[i]+' ';
 
end;
 
procedure InitializeWizard();
begin
    myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面');
    
    lbl:=TLabel.Create(myPage);
    lbl.Parent:=myPage.Surface;
    
    clb1 := TNewCheckListBox.Create(mypage);
clb1.Width := mypage.SurfaceWidth;
clb1.Top:=20;
clb1.Height := ScaleY(200);
clb1.Flat := True;
clb1.Parent := mypage.Surface;
clb1.AddCheckBox('操作系统', '', 0, True, True, False, True, nil);
clb1.AddRadioButton('Windows 2000', '', 1, False, True, nil);
clb1.AddRadioButton('Windows XP', '', 1, True, True, nil);
clb1.AddRadioButton('Windows 7', '', 1, False, True, nil);
clb1.AddCheckBox('可安装组件', '', 0, True, True, False, True, nil);
 
clb1.AddCheckBox('组件1', '', 1, True, True, False, True, nil);
    clb1.AddCheckBox('组件2', '', 1, True, True, False, True, nil);
    clb1.AddCheckBox('组件3', '', 1, False, True, False, True, nil);
    clb1.OnClickCheck:=@clbClickCheck;   
end;

运行效果如下:
Inno Setup入门(二十五)——Inno Setup类参考(11) - Castor - 趁年轻,多折腾
 

其中的 procedure clbClickCheck将动态地根据所选项进行自动调整。 

 

 

转自:http://www.360doc.com/content/13/0327/14/4221543_274238357.shtml

转载于:https://www.cnblogs.com/xiurui12345/archive/2013/05/24/3096604.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值