In diesem Beispiel ging es darum das nur Nummern plus Next-Knopf erst wenn mindestens ein Zeichen da steht.
Zitat:
You can setup the next button to be enabled or disabled in the CurPageChanged event when the user reaches the page where resides your edit box. Except that you need to monitor changes of that edit box to enable or disable the next button according to whether there's something entered in that edit box. For this you need to write a handler for the OnChange event. Here is an example:
Delphi-Quellcode:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
var
MyEdit: TNewEdit;
MyPage: TWizardPage;
procedure MyEditChange(Sender: TObject);
begin
// enable the next button if the edit box is not empty; disable otherwise
WizardForm.NextButton.Enabled := MyEdit.Text <> '';
end;
procedure MyEditKeyPress(Sender: TObject; var Key: Char);
var
KeyCode: Integer;
begin
// allow only numbers
KeyCode := Ord(Key);
if not ((KeyCode = 8) or ((KeyCode >= 48) and (KeyCode <= 57))) then
Key := #0;
end;
procedure InitializeWizard;
begin
MyPage := CreateCustomPage(wpWelcome, 'Caption', 'Description');
MyEdit := TNewEdit.Create(WizardForm);
MyEdit.Parent := MyPage.Surface;
MyEdit.Left := 0;
MyEdit.Top := 0;
MyEdit.Width := 150;
MyEdit.OnChange := @MyEditChange;
MyEdit.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 = MyPage.ID then
WizardForm.NextButton.Enabled := MyEdit.Text <> '';
end;
Das funktioniert! Nur ich benutze zusätzlich "Graphical Installer Wizard for Inno Setup" und damit zusammen funktioniert es leider nicht mehr. Ich kann so viele Zahlen eingeben wie ich möchte, der Next Buttom wird nicht aktiv.