注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

信息 灵感 创新

I? =Information,Inspiration,Innovation

 
 
 

日志

 
 
关于我

we are 5. Mathematics, Computation, Programming, Engineering, and Making fun of life.

网易考拉推荐

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

2012-07-07 17:51:34|  分类: Inno Setup |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |
今天说说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将动态地根据所选项进行自动调整。 

  评论这张
 
阅读(2230)| 评论(2)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2016