Цитата LordSP:
Все также,кнопка далее не активна пока не установишь чебокс »
|
Ну вообще-то для этого и есть страница с Лицензией, если он не согласен, то не сможет установить программу, т.е. моё мнение - RadioButton'ы должны быть всегда.
Пример
Код:

[Setup]
AppName=My Program
AppVerName=My Program v 1.5
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
LicenseFile=compiler:License.txt
OutputDir=.
Compression=lzma2/ultra
InternalCompressLevel=ultra
SolidCompression=yes
[Languages]
Name: rus; MessagesFile: compiler:Languages\Russian.isl
[Files]
Source: compiler:Libraries\InnoCallback.dll; Flags: dontcopy
[Code]
type
TTextMetric = record
tmHeight: Longint;
tmAscent: Longint;
tmDescent: Longint;
tmInternalLeading: Longint;
tmExternalLeading: Longint;
tmAveCharWidth: Longint;
tmMaxCharWidth: Longint;
tmWeight: Longint;
tmOverhang: Longint;
tmDigitizedAspectX: Longint;
tmDigitizedAspectY: Longint;
tmFirstChar: Char;
tmLastChar: Char;
tmDefaultChar: Char;
tmBreakChar: Char;
tmItalic: Byte;
tmUnderlined: Byte;
tmStruckOut: Byte;
tmPitchAndFamily: Byte;
tmCharSet: Byte;
end;
Pointer = procedure(Sender: TObject);
function GetDC(hWnd: HWND): LongWord; external 'GetDC@user32.dll stdcall';
function SelectObject(DC: LongWord; p2: LongWord): LongWord; external 'SelectObject@gdi32.dll stdcall';
function GetWindowRect(hWnd: HWND; var lpRect: TRect): BOOL; external 'GetWindowRect@user32.dll stdcall';
function GetTextMetrics(DC: LongWord; var TM: TTextMetric): BOOL; external 'GetTextMetricsA@gdi32.dll stdcall';
function ReleaseDC(hWnd: HWND; hDC: LongWord): Integer; external 'ReleaseDC@user32.dll stdcall';
function WrapTimerProc(callback: Pointer; paramcount: Integer): LongWord; external 'wrapcallback@files:InnoCallback.dll stdcall';
function SetTimer(hWnd: LongWord; nIDEvent, uElapse: LongWord; lpTimerFunc: LongWord): LongWord; external 'SetTimer@user32.dll stdcall';
function KillTimer(hWnd: LongWord; nIDEvent: LongWord): LongWord; external 'KillTimer@user32.dll stdcall';
const
EM_GETRECT = $00B2;
EM_GETFIRSTVISIBLELINE = $00CE;
var
TimerID: LongWord;
IsReadLicense: Boolean;
function GetFirstVisibleLine(const Memo: TMemo): Integer;
begin
Result := SendMessage(Memo.Handle, EM_GETFIRSTVISIBLELINE, 0, 0);
end;
function GetCountVisibleLines(const Memo: TMemo): Integer;
var
OldFont: LongWord;
Hand: THandle;
TM: TTextMetric;
Rect: TRect;
begin
Hand := GetDC(Memo.Handle);
try
OldFont := SelectObject(Hand, Memo.Font.Handle);
GetTextMetrics(Hand, TM);
GetWindowRect(Memo.Handle, Rect);
Result := ((Rect.Bottom - Rect.Top) div (TM.tmHeight + TM.tmExternalLeading));
finally
ReleaseDC(Memo.Handle, SelectObject(Hand, OldFont));
end;
end;
function GetLastVisibleLine(const Memo: TMemo): Boolean;
begin
Result := (GetFirstVisibleLine(Memo) + GetCountVisibleLines(Memo)) >= (Memo.Lines.Count-1);
end;
procedure TimerProc(Sender: TObject);
begin
if not IsReadLicense and GetLastVisibleLine(WizardForm.LicenseMemo) then
begin
WizardForm.LicenseAcceptedRadio.Enabled := True;
// WizardForm.LicenseAcceptedRadio.Checked := True;
IsReadLicense := True;
end;
end;
procedure InitializeWizard();
begin
TimerID := 0;
IsReadLicense := False;
WizardForm.LicenseAcceptedRadio.Enabled := False;
// WizardForm.LicenseAcceptedRadio.Hide;
// WizardForm.LicenseNotAcceptedRadio.Hide;
// WizardForm.LicenseMemo.Height := WizardForm.LicenseMemo.Height + ScaleY(35);
end;
procedure CurPageChanged(CurPageID: Integer);
begin
case CurPageID of
wpLicense:
if not IsReadLicense then
TimerID := SetTimer(0, 0, 50, WrapTimerProc(@TimerProc, 0));
else
if TimerID > 0 then
begin
KillTimer(0, TimerID);
TimerID := 0;
end;
end;
end;
Если вы всё же хотите сделать без RadioButton'ов, просто раскоментируйте строки.
P.S.
nik1967, этот пример из сборника скриптов, не совсем корректен, т.к. не определяет, прокрутил ли пользователь скролбар до конца.
Ну и по хорошему ещё сюда нужно прикрутить хинт или лэйбл какой-нибудь сделать, чтоб если пользователь резко прокрутил скролбар, то значит не читал и об этом написать ему, что мол читать надо вдумчиво...
