Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Setup]
- AppName=My Program
- AppVersion=1.5
- DefaultDirName={pf}\My Program
- [Code]
- var
- EditIndex: Integer;
- InputPage: TInputQueryWizardPage;
- procedure MyEditChange(Sender: TObject);
- begin
- // enable the next button if the edit box is not empty; disable otherwise
- WizardForm.NextButton.Enabled := InputPage.Edits[EditIndex].Text <> '';
- end;
- procedure MyEditKeyPress(Sender: TObject; var Key: Char);
- var
- KeyCode: Integer;
- begin
- KeyCode := Ord(Key);
- if not ((KeyCode = 8) or ((KeyCode >= 48) and (KeyCode <= 57))) then
- Key := #0;
- end;
- procedure InitializeWizard;
- begin
- // create the input query page
- InputPage := CreateInputQueryPage(wpWelcome, 'Caption', 'Description', 'SubCaption');
- // add an edit box and remember its index; False means it is not a password edit
- EditIndex := InputPage.Add('Some value:', False);
- // bind events to the just added edit box
- InputPage.Edits[EditIndex].OnChange := @MyEditChange;
- InputPage.Edits[EditIndex].OnKeyPress := @MyEditKeyPress;
- end;
- procedure CurPageChanged(CurPageID: Integer);
- begin
- // if the currently turned wizard page is the one with the edit box, enable
- // the next button if the edit box is not empty; disable otherwise
- if CurPageID = InputPage.ID then
- WizardForm.NextButton.Enabled := InputPage.Edits[EditIndex].Text <> '';
- end;
- procedure CurStepChanged(CurStep: TSetupStep);
- begin
- // if the installation has just finished, save the edit box text into a file
- if CurStep = ssPostInstall then
- SaveStringToFile('C:\File.txt', InputPage.Edits[EditIndex].Text, False);
- end;
Advertisement
Add Comment
Please, Sign In to add comment