Created
March 16, 2019 16:25
-
-
Save johnstevenson/98dcb4603ec1f780d0ac6565d4e0a424 to your computer and use it in GitHub Desktop.
Inno 6 - bug when resizing dynamically set TNewStaticText captions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; -- inno6-resize.iss -- | |
; Demonstrates TNewStaticText not resizing when set dynamically | |
[Setup] | |
AppName=Composer | |
AppVersion=5.0 | |
WizardStyle=modern | |
CreateAppDir=no | |
DisableProgramGroupPage=yes | |
OutputDir=userdocs:Inno Setup Examples Output | |
PrivilegesRequired=lowest | |
[Code] | |
var | |
GSettingsCombo: TNewComboBox; | |
GSettingsInfo: TNewStaticText; | |
procedure SettingsComboChange(Sender: TObject); | |
begin | |
if GSettingsCombo.ItemIndex = 0 then | |
GSettingsInfo.Caption := 'This is the PHP in your path. Click Next to use it.' | |
else | |
GSettingsInfo.Caption := 'This will replace the PHP entry in your path. Click Next if you want to do this.'; | |
end; | |
procedure CreateSettingPage; | |
var | |
Page: TWizardPage; | |
Text, StaticText: TNewStaticText; | |
Browse: TNewButton; | |
S: String; | |
begin | |
Page := CreateCustomPage(wpWelcome, 'Settings Check', 'We need to check your PHP and other settings.'); | |
Text := TNewStaticText.Create(Page); | |
Text.Anchors := [akLeft, akTop, akRight]; | |
Text.AutoSize := True; | |
Text.Caption := 'Choose the command-line PHP you want to use:'; | |
Text.Parent := Page.Surface; | |
GSettingsCombo := TNewComboBox.Create(Page); | |
GSettingsCombo.Top := Text.Top + Text.Height + ScaleY(8); | |
GSettingsCombo.Width := Page.SurfaceWidth - (ScaleX(75) + ScaleX(10)); | |
GSettingsCombo.Anchors := [akLeft, akTop, akRight]; | |
GSettingsCombo.Style := csDropDownList; | |
GSettingsCombo.OnChange := @SettingsComboChange; | |
GSettingsCombo.Parent := Page.Surface; | |
Browse := TNewButton.Create(Page); | |
Browse.Top := GSettingsCombo.Top - ScaleY(1); | |
Browse.Left := Page.SurfaceWidth - ScaleX(75); | |
Browse.Width := ScaleX(75); | |
Browse.Height := ScaleY(23); | |
Browse.Anchors := [akTop, akRight]; | |
Browse.Caption := '&Browse...'; | |
Browse.Parent := Page.Surface; | |
{ This does not resize } | |
GSettingsInfo := TNewStaticText.Create(Page); | |
GSettingsInfo.Top := GSettingsCombo.Top + GSettingsCombo.Height + ScaleY(8); | |
GSettingsInfo.Width := GSettingsCombo.Width; | |
GSettingsInfo.Anchors := [akLeft, akTop, akRight]; | |
GSettingsInfo.AutoSize := True; | |
GSettingsInfo.WordWrap := True; | |
GSettingsInfo.Parent := Page.Surface; | |
GSettingsInfo.Caption := ''; | |
StaticText := TNewStaticText.Create(Page); | |
StaticText.Top := GSettingsInfo.Top + GSettingsInfo.Height + ScaleY(50); | |
StaticText.Width := GSettingsCombo.Width; | |
StaticText.Anchors := [akLeft, akTop, akRight]; | |
StaticText.AutoSize := True; | |
StaticText.WordWrap := True; | |
StaticText.Parent := Page.Surface; | |
S := 'This TNewStaticText demonstrates the correct behaviour when it is resized.'; | |
S := S + ' Change the selection above then reduce the width of the form to show'; | |
S := S + ' how the dynamically added caption does not alway resize correctly'; | |
StaticText.Caption := S; | |
end; | |
procedure InitializeWizard(); | |
begin | |
CreateSettingPage; | |
GSettingsCombo.Items.Add('C:\php-7.3.1'); | |
GSettingsCombo.Items.Add('C:\xampp\php-5.4.1'); | |
GSettingsCombo.ItemIndex := 0; | |
SettingsComboChange(GSettingsCombo); | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment