zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    1、线性DP 198. 打家劫舍
    1、线性DP 354. 俄罗斯套娃信封问题
    127. 单词接龙
    1. 线性DP 887. 鸡蛋掉落 (DP+二分)
    200. 岛屿数量
    1. 线性DP 152. 乘积最大子数组
    1. 线性DP 53. 最大子序和.
    1. 线性DP 120. 三角形最小路径和
    如何在RHEL 8上安装Python 3
    在Ubuntu 20.04 LTS Focal Fossa上安装Drupal
  • 原文地址:https://www.cnblogs.com/xiurui12345/p/3096604.html
Copyright © 2011-2022 走看看