【转载】Inno Setup入门(二十四)——Inno Setup类参考(10)
2017-03-08 11:48
435 查看
这里介绍一下FolderTreeView 类。
TFolderTreeView = class(TCustomFolderTreeView) property OnChange: TNotifyEvent; read write; property OnRename: TFolderRenameEvent; read write;end;而TCustomFolderTreeView又继承自TWinControl,所以和其他基本控件一样具有许多类似的属性,此处不再重复。
贴出代码段:[code]varmyPage:TWizardPage; ftv: TFolderTreeView;
procedure InitializeWizard();begin myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面'); ftv := TFolderTreeView.Create(myPage); ftv.Width := myPage.SurfaceWidth; ftv.Height := myPage.SurfaceHeight; ftv.Parent := myPage.Surface; ftv.Directory := ExpandConstant('{win}');end;
有必要对 ExpandConstant进行解释一下。该函数的原型为:
function ExpandConstant(const S: String): String;
描述为:Changes all constants in S to their values. For example, ExpandConstant('{srcexe}') is changed to the filename of Setup.An exception will be raised if there was an error expanding the constants.
即将字符串常量展开为所对于的路径字符串。常用的常量有{app}、{win}、{sys}、{src}、{dotnet20}等,避免了手动输入的麻烦。
运行效果如下:
另外,该类支持一个OnChange的事件,当文件夹被修改时触发。
[code]varmyPage:TWizardPage; ftv: TFolderTreeView;lbl: TLabel;
procedure ChangeDir(Sender: TObject);begin lbl.Caption:=ftv.Directory;end;
procedure InitializeWizard();begin myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面'); lbl:=TLabel.Create(myPage); lbl.Parent:=myPage.Surface; ftv := TFolderTreeView.Create(myPage); ftv.Top:=lbl.Height+5; ftv.Width := myPage.SurfaceWidth; ftv.Height := myPage.SurfaceHeight-20; ftv.Parent := myPage.Surface; ftv.Directory := ExpandConstant('{win}'); ftv.OnChange:=@ChangeDir; lbl.Caption:=ftv.Directory; end;
这次运行的效果如下:
可见标签的值和文件夹的值保持一致。
TFolderTreeView = class(TCustomFolderTreeView) property OnChange: TNotifyEvent; read write; property OnRename: TFolderRenameEvent; read write;end;而TCustomFolderTreeView又继承自TWinControl,所以和其他基本控件一样具有许多类似的属性,此处不再重复。
贴出代码段:[code]varmyPage:TWizardPage; ftv: TFolderTreeView;
procedure InitializeWizard();begin myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面'); ftv := TFolderTreeView.Create(myPage); ftv.Width := myPage.SurfaceWidth; ftv.Height := myPage.SurfaceHeight; ftv.Parent := myPage.Surface; ftv.Directory := ExpandConstant('{win}');end;
有必要对 ExpandConstant进行解释一下。该函数的原型为:
function ExpandConstant(const S: String): String;
描述为:Changes all constants in S to their values. For example, ExpandConstant('{srcexe}') is changed to the filename of Setup.An exception will be raised if there was an error expanding the constants.
即将字符串常量展开为所对于的路径字符串。常用的常量有{app}、{win}、{sys}、{src}、{dotnet20}等,避免了手动输入的麻烦。
运行效果如下:
另外,该类支持一个OnChange的事件,当文件夹被修改时触发。
[code]varmyPage:TWizardPage; ftv: TFolderTreeView;lbl: TLabel;
procedure ChangeDir(Sender: TObject);begin lbl.Caption:=ftv.Directory;end;
procedure InitializeWizard();begin myPage:=CreateCustomPage(wpWelcome, '标题:自定义页面', '描述:这是我的自定义页面'); lbl:=TLabel.Create(myPage); lbl.Parent:=myPage.Surface; ftv := TFolderTreeView.Create(myPage); ftv.Top:=lbl.Height+5; ftv.Width := myPage.SurfaceWidth; ftv.Height := myPage.SurfaceHeight-20; ftv.Parent := myPage.Surface; ftv.Directory := ExpandConstant('{win}'); ftv.OnChange:=@ChangeDir; lbl.Caption:=ftv.Directory; end;
这次运行的效果如下:
可见标签的值和文件夹的值保持一致。
相关文章推荐
- Inno Setup入门(二十四)——Inno Setup类参考(10)
- 【转载】Inno Setup入门(二十一)——Inno Setup类参考(7)
- 【转载】Inno Setup入门(二十三)——Inno Setup类参考(9)
- 【转载】Inno Setup入门(十九)——Inno Setup类参考(5)
- 【转载】Inno Setup入门(十六)——Inno Setup类参考(2)
- 【转载】Inno Setup入门(二十二)——Inno Setup类参考(8)
- (转)Inno Setup入门(二十二)——Inno Setup类参考(8)
- Inno Setup入门(十六)——Inno Setup类参考(2)
- Inno Setup入门(十九)——Inno Setup类参考(5)
- Inno Setup入门(十八)——Inno Setup类参考(4)
- (转)Inno Setup入门(十七)——Inno Setup类参考(3)
- Inno Setup入门(二十)——Inno Setup类参考(6)
- (转)Inno Setup入门(二十一)——Inno Setup类参考(7)
- Inno Setup入门(十八)——Inno Setup类参考(4)
- Inno Setup入门(十七)——Inno Setup类参考(3)
- (转)Inno Setup入门(十六)——Inno Setup类参考(2)
- Inno Setup入门(十八)——Inno Setup类参考(4)
- Inno Setup入门(十九)——Inno Setup类参考(5)
- (转)Inno Setup入门(十八)——Inno Setup类参考(4)
- Inno Setup入门(二十)——Inno Setup类参考(6)