2013-05-11 118 views
2

尝试在wpSelectComponents窗体上放置一些文本。wpSelectComponents上的Inno设置文本

我可以在这个WizardForm上显示一个按钮,我可以显示一个面板(通过声明面为WizardForm和visible=False,直到CurrPageId = wpSelectComponents),但我似乎无法显示文本消息。

我可以在面板内显示文本(作为标题),但我不能使用chr(13)来创建换行符。

是否可以在预定义的向导页面上显示文本? (两段简短)。

回答

3

如果您要显示带有按钮和带有多行文本的标签的面板,则只能在特定页面的内容下(在此例中为选择组件页面),您可能需要灵感在下面的脚本:

[Setup] 
AppName=My Program 
AppVersion=1.5 
DefaultDirName={pf}\My Program 
OutputDir=userdocs:Inno Setup Examples Output 

[Components] 
Name: "main"; Description: "Main Files"; Types: full compact custom; Flags: fixed 
Name: "help"; Description: "Help Files"; Types: full 
Name: "help\english"; Description: "English"; Types: full 
Name: "help\dutch"; Description: "Dutch"; Types: full 

[Code] 
var 
    Panel: TPanel; 

procedure FuncButtonClick(Sender: TObject); 
begin 
    MsgBox('You did it!', mbInformation, MB_OK); 
end; 

procedure InitializeWizard; 
var 
    DescLabel: TLabel; 
    FuncButton: TNewButton; 
    ContentHeight: Integer; 
begin 
    ContentHeight := WizardForm.OuterNotebook.Top + 
    WizardForm.OuterNotebook.Height; 

    Panel := TPanel.Create(WizardForm); 
    Panel.Parent := WizardForm; 
    Panel.Left := 4; 
    Panel.Top := ContentHeight + 4; 
    Panel.Width := WizardForm.BackButton.Left - 8; 
    Panel.Height := WizardForm.ClientHeight - ContentHeight - 8; 
    Panel.Visible := False; 

    FuncButton := TNewButton.Create(WizardForm); 
    FuncButton.Parent := Panel; 
    FuncButton.Left := (Panel.Height - FuncButton.Height) div 2; 
    FuncButton.Top := (Panel.Height - FuncButton.Height) div 2; 
    FuncButton.Caption := 'Click me!'; 
    FuncButton.OnClick := @FuncButtonClick; 

    DescLabel := TLabel.Create(WizardForm); 
    DescLabel.Parent := Panel; 
    DescLabel.AutoSize := True; 
    DescLabel.Caption := 'Hello,' #13#10 + 'I''m your label! :-)'; 
    DescLabel.Left := FuncButton.Left + FuncButton.Width + 8; 
    DescLabel.Top := (Panel.Height - DescLabel.Height) div 2; 
end; 

procedure CurPageChanged(CurPageID: Integer); 
begin 
    Panel.Visible := CurPageID = wpSelectComponents; 
end; 

下面是结果:

enter image description here

+0

您再次指导我了解如何在Inno Setup中做些事情。关于帮助,特别是支持类参考,我确实有一个问题。在遵循您的优秀示例并将其集成到我的设置后,我决定在DescLabel中添加一个边框。当您检查帮助时,所有内容都以TBorderWidth之类的T开头,但如果您尝试使用它,则会出现错误,但如果删除了T,则可以使用。 T必须有一个理由,但我看不到它是什么。再次感谢您的帮助。 – grahamskaraoke 2013-05-11 21:50:07

+0

'T'代表''TLama''是'Lama'的类型,它只是一个不成文的标准。你试图改变的是'TBorderWidth'类型的'BorderWidth'属性。但是您在标签边框的边框请求并不容易,因为“TLabel”或“TNewStaticText”(类似于标签组件)没有边框支持。我会亲自使用另一个面板并在其上放置该标签。 – TLama 2013-05-11 22:05:10

+0

要了解哪些属性可用于某个类别类型,例如对于'TLabel',你需要通过该类的继承树。例如'TLabel'被定义为'TLabel = class(TCustomLabel)'这意味着它是从'TCustomLabel'类继承的; 'TCustomLabel'被定义为'TCustomLabel = class(TGraphicControl)',所以它是从'TGraphicControl'等继承的(你可以点击类祖先以获得简单的导航帮助)。并且此类树中的每个类都可以添加其发布的属性,您可以在脚本中使用它们。 – TLama 2013-05-11 22:29:12

2

你可能想看看DescriptiveTypes script;它会在此页面上控制一些控件以显示当前所选类型的详细说明。带有边框。

+0

谢谢。我打算玩这个。当我参考边界宽度我的意思是面板。我能够用TBorderStyle = bsraised做我想做的事情。我遇到的一个问题是找到(并理解)一些更有用的脚本,所以我基本上复制,粘贴,查看它的功能,然后尝试更改,直到获得我喜欢的内容。但是,这可能会产生意想不到的结果。在同一页上的Inno Setup对话框文件似乎是一个有趣的概念。 – grahamskaraoke 2013-05-13 23:35:44