How to customize last page (wpFinished) to only have a message, but keep the bottom buttons, like this:
I don't want the image on the left that is there by default.
I was trying to create new page, but don't know how to hide the default finished page or add bottom buttons (Back, Finished, Cancel) on new page.
Hide the WizardBitmapImage2 control and extend remaining controls accordingly.
Something like this:
[Code]
procedure ExtendFinishedPageControl(Control: TControl);
begin
Control.Left := Control.Left - WizardForm.WizardBitmapImage2.Width;
Control.Width := Control.Width + WizardForm.WizardBitmapImage2.Width;
end;
procedure InitializeWizard();
begin
WizardForm.WizardBitmapImage2.Visible := False;
ExtendFinishedPageControl(WizardForm.RunList);
ExtendFinishedPageControl(WizardForm.NoRadio);
ExtendFinishedPageControl(WizardForm.YesRadio);
ExtendFinishedPageControl(WizardForm.FinishedLabel);
ExtendFinishedPageControl(WizardForm.FinishedHeadingLabel);
end;
I was creating a Form with some buttons in runtime in my application and I realized something that's bothering me a lot and I couldn't figure for myself or anywhere in the internet.
Look at the following code.
procedure TfrmTest.CreateFourButtons(Sender: TObject);
var
i: Integer; B: TButton;
begin
for i := 1 to 4 do
begin
B := TButton.Create(frmTest);
B.Parent := frmTest;
B.SetBounds(250,(70+(30*i)),75,25);
B.Caption := 'Button' + IntToStr(i);
B.Visible := True;
end;
end;
So I just created four buttons at runtime on a form in specific locations. So far so good right?
But now let's imagine that I want to change the Caption property of the first button to "HotPotato"? How do I reference the first button now since I used just one variable to create those buttons? I've been told to store those objects in an array of TButtons or better yet in an TObjectList and these are all fine solutions to this problem. But then one question came to my mind!
Where are those buttons located in the memory? Are the any ways for me to reference them without using arrays or object lists?
The normal way to keep track of multiple similar object is to use an array.
procedure TfrmTest.CreateFourButtons(Sender: TObject);
var
i: Integer;
B: TArray<TButton>; //or array of TButton for older versions
begin
SetLength(B, 4);
for i := 0 to 3 do begin
B[i] := TButton.Create(frmTest);
B[i].Parent := frmTest;
B[i].SetBounds(250,(70+(30*i)),75,25);
B[i].Caption := 'Button' + IntToStr(i);
B[i].Visible := True;
end;
B[0].Caption:= 'HotPotato';
end;
When placing buttons on a form this is not strictly needed, the form already uses a list to keep track of child controls placed on it, but you'll need some way to tell the different buttons apart.
You can use the tag property for this:
for i := 1 to 4 do begin
B := TButton.Create(frmTest);
B.Parent := frmTest;
B.Tag:= i;
...
end;
//This will get inefficient if there are many controls on a form.
for var C in frmTest.Controls do begin //10.3 syntax.
if (C is TButton) and (C.tag = 1) then C.Caption:= 'HotPotato'
end;
The button is an object and it is thus located on the heap. If you lose its reference you will never find it again. However if it is placed on a parent control, then that parent will keep track of it and you can always get it using FindChildControl or the Controls list of the form.
FindChildControl does a search by name. This requires you to set the name of the control, or it will not work.
var B:= frmTest.FindChildControl('Button1');
Note: FindChildControl only locates immediate children of the control. It can't find a control that is a child of one of the control's children.
This locating children can get complicated if the button is located in a subpanel. Better to use the array or a list to keep track of a range of buttons.
I want to show a Nice Welcome Animated GIF to my users when running my Program Installer created using Inno Setup.
I want to display some PNG Images to an order (As Inno Setup doesn't support displaying Animated GIFs yet) using Isgsg.dll until Setup finishes initializing my tons of codes.
I wrote a code to show those PNG Images in order, but it stops after last one is shown.
I need to continue showing from first PNG Image after last one shown before.
If Setup was initialized,(I mean if WizardForm is visible) the Looping Procedure should stop.
The Codes I wrote to display those PNG Images:
function InitializeSetup(): Boolean;
var
DlgWait: TForm;
if Result = True then begin
ExtractTemporaryFile('Welcome1.png');
ExtractTemporaryFile('Welcome2.png');
ExtractTemporaryFile('Welcome3.png');
ExtractTemporaryFile('Welcome4.png');
ExtractTemporaryFile('Welcome5.png');
ExtractTemporaryFile('Welcome6.png');
ExtractTemporaryFile('Welcome7.png');
<<< LOOPING SHOULD BEGIN FROM HERE >>>
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome1.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome2.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome3.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome4.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome5.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome6.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome7.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
<<< LOOPING SHOULD CONTINUE FROM HERE IF NOT WizardForm VISIBLE, OTHERWISE LOOPING SHOULD BE STOPPED >>>
...
end;
How can I do this as I expect?
UPDATED QUESTION
I can't think why this Code is not working.
This DLL requires PNG File's Filename as an AnsiString.
But I've provided a String.
Is this gone wrong or any other Synatx Error Here for this to not working?
Not Working means those PNG Images Showing Loop Procedure not working.
The Code I tried to add to do this Conditional Loop using Repeat Until:
function InitializeSetup(): Boolean;
var
DlgWait: TForm;
IMessageHandler: TForm;
X: Integer;
ErrorCode: Integer;
LblWait: TLabel;
if Result := True then begin
DlgWait := TForm.Create(nil);
DlgWait.Hide;
begin
Order:=1;
Repeat
ShowSplashScreen(DlgWait.Handle,ExpandConstant('{tmp}\Welcome+IntToStr(Order)+.png'),0250,1000,0250,0,255,True,$FFFFFF,10);
Order:=Order+1;
Until FileExists(ExpandConstant('{tmp}\Welcome+IntToStr(Order)+.png')) = False;
end;
end;
Are there any syntax Errors?
But Compiler doesn't give any Compiler Warning or Error.
Thanks in Advance.
You need to reset your counter when you've reached the end. Something like this should get you started. (NOTE: Untested - I don't have InnoSetup on this machine. Replace the test in the until with whatever is appropriate to detect the WizardForm being visible.)
function InitializeSetup(): Boolean;
var
DlgWait: TForm;
IMessageHandler: TForm;
X: Integer;
ErrorCode: Integer;
LblWait: TLabel;
const
NumImages = 7;
begin
if Result then
begin
DlgWait := TForm.Create(nil);
DlgWait.Hide;
Order := 1;
repeat
ShowSplashScreen(DlgWait.Handle, ExpandConstant('{tmp}\Welcome' + IntToStr(Order) + '.png'), 0250, 1000, 0250, 0,255, True, $FFFFFF, 10);
Order := Order + 1;
if Order > NumImages then
Order := 1;
until WizardForm.Visible;
end;
end;
I am trying to place a label on the wpPreparing page to indicate uninstallation of an existing version, prior to running the new installation. Here is my code:
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
UninstallingLabel: TNewStaticText;
intResultCode: Integer;
begin
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.StatusLabel.Left;
Top := WizardForm.StatusLabel.Top;
Parent := wpPreparing.Surface;
end;
if strExistingInstallPath <> '' then
begin
Exec(GetUninstallString, '/verysilent /suppressmsgboxes', '', SW_HIDE,
ewWaitUntilTerminated, intResultCode);
end;
end;
The trouble is it does not seem to like Parent := wpPreparing.Surface and compiling fails with a
Semicolon (;) expected
error. This syntax works when adding a label to a custom created page. Why does this fail when trying to add it to wpPreparing?
The wpPreparing is not an object, it's just a numerical constant.
The WizardForm.PreparingPage holds a reference to the "Preparing to Install" page. Note that it is of type TNewNotebookPage already, not TWizardPage. So you use it directly as a parent.
Also note that the StatusLabel is on the "Installing" page. You probably want to relate your new label to the PreparingLabel instead.
And you have to create the UninstallingLabel.
UninstallingLabel := TNewStaticText.Create(WizardForm);
with UninstallingLabel do
begin
Caption := 'Uninstalling existing version...';
Left := WizardForm.PreparingLabel.Left;
Top := WizardForm.PreparingLabel.Top;
Parent := WizardForm.PreparingPage;
end;
Though do you really want to shadow the PreparingLabel (as you use its coordinates).
What about reusing it instead?
WizardForm.PreparingLabel.Caption := 'Uninstalling existing version...';
I've replayed your code. It works if you use just WizardForm as the parent. But it's in the top left corner of the form...
wpPreparing is the name of a constant that holds the ID of the correspnding page.
And you have to create an instance of UninstallingLabel
Is it possible to conditionally disable or hide edit boxes from a TInputQueryWizardPage input page (page created by using CreateInputQueryPage function) ?
I have 4 edit boxes and I need to disable/hide the last two of them, based on the input from the previous wizard page. How can I do it ?
You can access them through the TInputQueryWizardPage.Edits indexed property:
[Code]
var
FirstEditIndex: Integer;
SecondEditIndex: Integer;
InputPage: TInputQueryWizardPage;
procedure InitializeWizard;
begin
InputPage := CreateInputQueryPage(wpWelcome, 'Caption', 'Dscription', 'SubCaption');
// the Add method returns the Index of the just added edit box, and
// you need to store those indexes to access the edit boxes later on
FirstEditIndex := InputPage.Add('Name:', False);
SecondEditIndex := InputPage.Add('Surname:', False);
// access the edits through the stored indexes; in your case this will
// happen in the other event, so take this script as a showcase
InputPage.Edits[FirstEditIndex].Enabled := False;
InputPage.Edits[SecondEditIndex].Visible := False;
end;