Back again with some questions yener, i suppose you didnt reply to my previous problem because you don't know the answer or my description was too vague.
Anyway, what im trying to do now, is to implement one password page in your awesome script. But it seems my scripting skills are sucky at the moment, but i have an excuse, im beginner.
Anyway, let's proceed with my problems:
The below code is in [SETUP]
Quote:
; Password setup
Encryption=false
Password=123456
#define EncryptPass
#define i Len(SetupSetting("Password"))
#for {i; i > 0; i--} EncryptPass = EncryptPass + Copy(SetupSetting("Password"), i, 1)
|
The below code is in [CODE]
Quote:
Function DecryptPass(Password: String): String;
var n: Integer;
Begin
for n:= Length(Password) Downto 1 do Result:= Result + Copy(Password, n, 1)
End;
Function CheckPassword(Password: String): Boolean;
Begin
Result:= (GetMD5OfString(Password) = DecryptPass('{#EncryptPass}'))
if not Result then exit;
PasswordText.Caption:= WizardForm.PasswordEdit.Text
WizardForm.PasswordEdit.Text:= DecryptPass('{#EncryptPass}')
PasswordText.Show
End;
Procedure PasswordEditOnKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
Begin
WizardForm.Nextbutton.Enabled:= CheckPassword(WizardForm.PasswordEdit.Text)
End;
|
This is the password page:
Quote:
////////////////////// PasswordPage //////////////////////
PasswordEditLabel := TLabel.Create(WizardForm);
with PasswordEditLabel do begin
AutoSize:=False;
Top:= TextPositionTop + 97 + MoveDirectoryInfo;
if Wizardform.RightToLeft then
Left := InstallerWidth - TextPositionWidth - TextPositionLeft + TextSpaceFromBorder + 7
else
Left:= TextPositionLeft + TextSpaceFromBorder + 7 ;
Width:= TextPositionWidth - 2* TextSpaceFromBorder - 14;
//SetBounds(ScaleX(127), ScaleY(308), ScaleX(446),16);
WordWrap:= True;
ShowAccelChar := False;
Transparent:=True;
Font.Name:= SetupFont;
Font.Size:= 10 + SetupFontSize;
Font.Color:=SetupFontColor;
//Font.Style:=[fsBold];
//Caption := MinimizePathName(WizardForm.PasswordEditLabel.Text , PasswordEditLabel.Font, PasswordEditLabel.Width);
//Caption:= WizardForm.PasswordEdit.Text;
Parent := WizardForm;
OnMouseMove:=@MainAreaMouseMove;
OnMouseDown:=@MainAreaMouseDown;
end;
PasswordText:=TPanel.Create(WizardForm)
with PasswordText do begin
WizardForm.PasswordEdit.OnKeyUp:= @PasswordEditOnKeyUp
PasswordText.SetBounds(WizardForm.PasswordEdit.Lef t, WizardForm.PasswordEdit.Top, WizardForm.PasswordEdit.Width, WizardForm.PasswordEdit.Height)
PasswordText.Font.Style:= [fsBold]
PasswordText.Alignment:=taLeftJustify
PasswordText.BevelOuter:= bvNone
PasswordText.BorderStyle:= bsSingle
PasswordText.Parent:= WizardForm.PasswordPage
PasswordText.Hide
end;
with Wizardform.PasswordEdit do begin
if Wizardform.RightToLeft then
Left := InstallerWidth - TextPositionWidth - TextPositionLeft + TextSpaceFromBorder
else
Left:= TextPositionLeft + TextSpaceFromBorder;
Top:= TextPositionTop + 95 + MoveDirectoryInfo;
Width:= TextPositionWidth - 2* TextSpaceFromBorder ;
Parent:=Wizardform
end;
////////////////////// PasswordPage //////////////////////
|
Quote:
wpPassword:
begin
Wizardform.PasswordEdit.Show
PasswordEditLabel.Show
end;
if CurPageID = wpPassword then if PasswordText.Caption = '' then
begin
WizardForm.Nextbutton.Enabled:= CheckPassword(WizardForm.PasswordEdit.Text);
if FileExists(ExpandConstant('{tmp}\Button.png')) then begin
NextBtnEnable(Wizardform.NextButton.Enabled)
end;
end;
|
Now, what i want to do is to enable the NEXT button when i enter the correct password. The problem is, even if i input the correct password, the NEXT button is Disabled. Any assistance please? Thanks in advance as always.