1
votes

How do you destroy an object created like below. I may need to change pages depending on answer to prior pages:

[Code]

var
  UninstallFirstPage: TNewNotebookPage;

procedure Whatever();
begin
  UninstallFirstPage := TNewNotebookPage.Create(UninstallProgressForm);
  UninstallFirstPage.Notebook := UninstallProgressForm.InnerNotebook;
  UninstallFirstPage.Parent := UninstallProgressForm.InnerNotebook;
  UninstallFirstPage.Align := alClient;
   ...

  { How do you destruct UninstallFirstPage - may want to change it after created }

end;
1

1 Answers

1
votes

In Inno Setup Pascal Script (in Delphi/VCL), you destroy an object by calling its destructor, which has a name Free:

UninstallFirstPage.Free;

A good practice is to reset the variable value afterwards:

UninstallFirstPage := nil;