在 Inno Setup 中更改 ComboBox 后,在下一个屏幕上动态显示控件和内容?
Dynamically show the control and content on next screen after ComboBox change in Inno Setup?
当我 运行 第一次使用此代码时,一切都按预期进行。但是一旦你 select Sonitor
然后 select BBraun
, Sonitor
控件(标签和文本框)不会消失,它们仍然在屏幕上。
[Code]
var
VendorPage, VendorHostPage: TWizardPage;
VendorText: TNewStaticText;
VendorEdit: TNewEdit;
ComboBox: TNewComboBox;
procedure ComboBoxChange(Sender: TObject);
begin
case ComboBox.ItemIndex of
0:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to the BBraun server to recieve the HL7 data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'BBraun HL7 port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
1:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to RTLS server to recieve streaming location data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Centrak RTLS Server IP address:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(50);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Centrak RTLS Server port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(50);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
2:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to RTLS server to recieve streaming location data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS Server IP address:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(50);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS Events port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(50);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(75);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS API port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(75);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
end;
end;
procedure InitializeWizard;
var
InstallJava: Boolean;
begin
VendorPage := CreateCustomPage(wpWelcome, 'RTLS HW Data Source Configuration', '');
VendorText := TNewStaticText.Create(VendorPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Please select the RTLS hardware vendor to install:';
VendorText.AutoSize := True;
VendorText.Parent := VendorPage.Surface;
VendorText := TNewStaticText.Create(VendorPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'RTLS Vendor';
VendorText.AutoSize := True;
VendorText.Parent := VendorPage.Surface;
ComboBox := TNewComboBox.Create(VendorPage);
ComboBox.Top := ScaleY(25);
ComboBox.Left := ScaleX(100);
ComboBox.Anchors := [akLeft, akTop, akRight];
ComboBox.Parent := VendorPage.Surface;
ComboBox.Style := csDropDown;
ComboBox.Items.Add('BBraun');
ComboBox.Items.Add('Centrak');
ComboBox.Items.Add('Sonitor');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
VendorHostPage := CreateCustomPage(VendorPage.ID, 'RTLS HW Data Source Configuration', 'Provide Connection details to Teletracking RTLS');
case ComboBox.ItemIndex of
0:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to the BBraun server to recieve the HL7 data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'BBraun HL7 port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
end;
end;
select离子组合框值后的预期行为:
PS:如果您在浏览器上看不到图像,请下载它,代码已经为前两个屏幕 ComboBox
和下一个屏幕编写了基于 selection not剩下的。
当然不是。在 Pascal 脚本中分配一个 object 变量不会破坏该变量先前指向的 object。
你必须明确地这样做。喜欢:
if Assigned(VendorText) then VendorText.Free;
虽然更常见的实现方式,但您想要的是在开始时创建一次控件,hiding/showing and/or 随着组合框选择的变化改变它们的标题。这样的解决方案需要的代码要少得多。
当我 运行 第一次使用此代码时,一切都按预期进行。但是一旦你 select Sonitor
然后 select BBraun
, Sonitor
控件(标签和文本框)不会消失,它们仍然在屏幕上。
[Code]
var
VendorPage, VendorHostPage: TWizardPage;
VendorText: TNewStaticText;
VendorEdit: TNewEdit;
ComboBox: TNewComboBox;
procedure ComboBoxChange(Sender: TObject);
begin
case ComboBox.ItemIndex of
0:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to the BBraun server to recieve the HL7 data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'BBraun HL7 port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
1:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to RTLS server to recieve streaming location data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Centrak RTLS Server IP address:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(50);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Centrak RTLS Server port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(50);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
2:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to RTLS server to recieve streaming location data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS Server IP address:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(50);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS Events port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(50);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(75);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Sonitor RTLS API port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(75);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
end;
end;
procedure InitializeWizard;
var
InstallJava: Boolean;
begin
VendorPage := CreateCustomPage(wpWelcome, 'RTLS HW Data Source Configuration', '');
VendorText := TNewStaticText.Create(VendorPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'Please select the RTLS hardware vendor to install:';
VendorText.AutoSize := True;
VendorText.Parent := VendorPage.Surface;
VendorText := TNewStaticText.Create(VendorPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'RTLS Vendor';
VendorText.AutoSize := True;
VendorText.Parent := VendorPage.Surface;
ComboBox := TNewComboBox.Create(VendorPage);
ComboBox.Top := ScaleY(25);
ComboBox.Left := ScaleX(100);
ComboBox.Anchors := [akLeft, akTop, akRight];
ComboBox.Parent := VendorPage.Surface;
ComboBox.Style := csDropDown;
ComboBox.Items.Add('BBraun');
ComboBox.Items.Add('Centrak');
ComboBox.Items.Add('Sonitor');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
VendorHostPage := CreateCustomPage(VendorPage.ID, 'RTLS HW Data Source Configuration', 'Provide Connection details to Teletracking RTLS');
case ComboBox.ItemIndex of
0:
begin
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'AssetTracking connects to the BBraun server to recieve the HL7 data';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorText := TNewStaticText.Create(VendorHostPage);
VendorText.Top := ScaleY(25);
VendorText.Anchors := [akLeft, akRight, akBottom];
VendorText.Caption := 'BBraun HL7 port:';
VendorText.AutoSize := True;
VendorText.Parent := VendorHostPage.Surface;
VendorEdit := TNewEdit.Create(VendorHostPage);
VendorEdit.Top := ScaleY(25);
VendorEdit.Left := ScaleX(200);
VendorEdit.Parent := VendorHostPage.Surface;
end;
end;
end;
select离子组合框值后的预期行为:
PS:如果您在浏览器上看不到图像,请下载它,代码已经为前两个屏幕 ComboBox
和下一个屏幕编写了基于 selection not剩下的。
当然不是。在 Pascal 脚本中分配一个 object 变量不会破坏该变量先前指向的 object。
你必须明确地这样做。喜欢:
if Assigned(VendorText) then VendorText.Free;
虽然更常见的实现方式,但您想要的是在开始时创建一次控件,hiding/showing and/or 随着组合框选择的变化改变它们的标题。这样的解决方案需要的代码要少得多。