Войти

Показать полную графическую версию : Скрипты Inno Setup. Помощь и советы [часть 5]


Страниц : 1 2 3 4 5 6 [7] 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

ToCamoe
30-05-2012, 16:22
1. как поменять иконку файла удаления, она по стандарту делается как иконка установщика, хочется другую. - вопрос решён
2. как сделать, чтобы при удаление, удалялась папка с её содержимым полностью, а не только те файлы, которые были установлены.
3. сколько переменных procedure InitializeWizard; может использоваться в одном коде ?

Raf-9600
30-05-2012, 16:51
1. как поменять иконку файла удаления, она по стандарту делается как иконка установщика, хочется другую. - вопрос решён »
Кстати, любопытно как это реализовано?

2. как сделать, чтобы при удаление, удалялась папка с её содержимым полностью, а не только те файлы, которые были установлены. »
Самый простой способ:

[UninstallDelete]
Type: files; Name: {app}

Gnom_aka_Lexander
30-05-2012, 17:01
ToCamoe, 2. как сделать, чтобы при удаление, удалялась папка с её содержимым »
[UninstallDelete]
Type: filesandordirs; Name: {app}
3. сколько переменных procedure InitializeWizard; »
Процедура и переменная - это разные совершенно понятия.
Инно не умеет работать с перегруженными функциями,(вроде-бы) поэтому одноименные функции нельзя выполнять в одном скрипте. но никто не запрещает эти функции ( как и процедуры ) переименовать и выполнить внутри одной procedure InitializeWizard.
GoshaPolo, Можно так:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[*Code]
var
NewCheckBox1, NewCheckBox2: TNewCheckBox;

procedure CheckBoxClick(Sender: TObject);
begin
case TNewCheckBox(Sender) of
NewCheckBox1 : NewCheckBox2.Checked := not NewCheckBox1.Checked;
NewCheckBox2 : NewCheckBox1.Checked := not NewCheckBox2.Checked;
end;
end;

procedure InitializeWizard();
begin
NewCheckBox1 := TNewCheckBox.Create(WizardForm);
with NewCheckBox1 do
begin
Parent := WizardForm;
SetBounds( ScaleX(40), ScaleY(320), ScaleX(13), ScaleY(13));
Checked := True;
end;

NewCheckBox2 := TNewCheckBox.Create(WizardForm);
with NewCheckBox2 do
begin
Parent := WizardForm;
SetBounds( ScaleX(40), ScaleY(340), ScaleX(13), ScaleY(13));
OnClick := @CheckBoxClick;
end;
NewCheckBox1.OnClick := @CheckBoxClick;
end;

Raf-9600, попозже чуток :)

ToCamoe
30-05-2012, 17:11
Кстати, любопытно как это реализовано? »

[Icons]
Name: {group}\Client; Filename: {app}\Client.exe; IconFilename: "C:\Users\Admin\img.ico";
Name: {group}\Деинсталлировать Client; Filename: {uninstallexe}; IconFilename: "C:\Users\Admin\img1.ico";

Самый простой способ: »

Получается, что так ?
[UninstallDelete] Type: files; Name: {app}\Имя папки

Gnom_aka_Lexander
30-05-2012, 17:16
Получается, что так ? »
Нет.
[UninstallDelete]
Type: files; Name: {app}
В справке есть - {app} - папка установки. твой вопрос был - удалялась папка с её содержимым полностью, »

Raf-9600
30-05-2012, 17:18
попозже чуток »
Буду ждать, так как для меня проблема весьма актуальна. http://i25.fastpic.ru/big/2011/0719/02/b3f16ceb30c04448d52500e216009302.gif

Получается, что так ? »
Если всю папку (со всем содержимым) в которую прога устанавливалась, то как сказал Gnom_aka_Lexander -
Type: filesandordirs; Name: {app} Если папку Name (со всем содержимым) , из той папки в которую производилась установка, то Type: filesandordirs; Name: {app}\Name
Вобще-то в русскоязычной справке этот момент достаточно хорошо объяснен.

Gnom_aka_Lexander
30-05-2012, 17:34
Raf-9600, Вспомнил. бедой такой я уже занимался. и сделать можно привязку к именам компонентов. но. зависимость от номера все равно останется. единственное, что можно сделать - привязку к Description, чтобы избавится от привязки к номерам. Выглядеть будет так:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application


[Components]
Name: "GameDiablo2"; Description: Diablo 2; Flags: fixed; Types: full compact custom;

Name: GameLoD; Description: Lord of Destruction; Types: full;

Name: Version; Description: Версия; Flags: fixed; Types: full compact custom;
Name: Version\107; Description: 1.07; Flags: exclusive;
Name: Version\108; Description: 1.08; Flags: exclusive;
Name: Version\109; Description: 1.09; Flags: exclusive; Types: full;

Name: NoCD; Description: NoCD; Types: full;

[*code]
var
OldEvent_ComponentsListClickCheck: TNotifyEvent;

procedure ComponentsListClickCheck(Sender: TObject);
var
i : Integer;
begin
for i := 0 to WizardForm.ComponentsList.ItemCount -1 do
begin
case WizardForm.ComponentsList.ItemCaption[i] of
'1.08', '1.09' : // перечисляем через запятую надписикомпонентов, которые зависят от GameLoD
WizardForm.ComponentsList.ItemEnabled[i] := IsComponentSelected('GameLoD');
'1.07' : // тут логично выбрать этот компонент, если отключаем остальные зависимые
WizardForm.ComponentsList.Checked[i] := not IsComponentSelected('GameLoD');
end;
end;
OldEvent_ComponentsListClickCheck(Sender);
end;

procedure InitializeWizard();
begin
with WizardForm.ComponentsList do
begin
OldEvent_ComponentsListClickCheck := OnClickCheck;
OnClickCheck := @ComponentsListClickCheck;
ItemEnabled[3]:=True;
end;
end;

zeroka_no_onna
30-05-2012, 17:45
Ап!
http://forum.oszone.net/post-1924730.html#post1924730
Не знает никто про диски?

Gnom_aka_Lexander
30-05-2012, 17:48
zeroka_no_onna, скртипт покажи. Пытался я тут телепатией заниматься - люди начинают завидовать и обижаться.

zeroka_no_onna
30-05-2012, 18:11
Вот скрипт#define NeedSize "1073741820"



#define NeedMem 0



;#define SecondProgressBar



;#define Components



#define records



#define facompress





[Setup]

SourceDir=.

OutputDir=J:\FEARBUILD

AppName=FEAR 2 Project Origin

AppVerName=FEAR 2 Project Origin

AppVersion=FEAR 2 Project Origin

DefaultDirName={pf}\FEAR 2 Project Origin

DefaultGroupName=FEAR 2 Project Origin

AllowNoIcons=yes

OutputBaseFilename=FEAR2setup

WizardImageFile=C:\путь\к\картинке

WizardSmallImageFile=C:\путь\к\картинке

SetupIconFile=C:\путь\к\картинке

WindowVisible=no

WindowShowCaption=no

WindowResizable=no

Compression=none

SolidCompression=no

DiskSpanning=yes

SlicesPerDisk=3

DiskSliceSize=1566000000

#ifdef NeedSize

ExtraDiskSpaceRequired={#NeedSize}

#endif









[Languages]

Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"



[Tasks]

Name: "LangEng"; Description: "Английский"; GroupDescription: "Язык интерфейса"; Flags: exclusive

Name: "LangRus"; Description: "Русский"; GroupDescription: "Язык интерфейса"; Flags: exclusive

Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"





[Icons]

Name: "{group}\FEAR 2 Project Origin"; Filename: "{app}\FEAR2.exe"; WorkingDir: "{app}";

Name: "{userdesktop}\FEAR 2 Project Origin"; Filename: "{app}\FEAR2.exe"; WorkingDir: "{app}"; Tasks: desktopicon;

Name: "{group}\{cm:UninstallProgram,FEAR 2 Project Origin}"; Filename: "{uninstallexe}"



[Registry]

Root: HKCU; Subkey: "SOFTWARE\Monolith Productions"; Flags: uninsdeletekeyifempty

Root: HKCU; Subkey: "SOFTWARE\Monolith Productions\FEAR2"; Flags: uninsdeletekey

Root: HKCU; Subkey: "SOFTWARE\Monolith Productions\FEAR2\1.00.0000"; ValueName: "LANGUAGE"; ValueType: String; ValueData: "ru"; Tasks: LangRus; Flags: uninsdeletekey

Root: HKCU; Subkey: "SOFTWARE\Monolith Productions\FEAR2\1.00.0000"; ValueName: "LANGUAGE"; ValueType: String; ValueData: "en"; Tasks: LangEng; Flags: uninsdeletekey

Root: HKLM; Subkey: "SOFTWARE\Monolith Productions, Inc."; Flags: uninsdeletekeyifempty

Root: HKLM; Subkey: "SOFTWARE\Monolith Productions\F.E.A.R. 2 Project Origin"; Flags: uninsdeletekey

Root: HKLM; Subkey: "SOFTWARE\Monolith Productions\F.E.A.R. 2 Project Origin\1.00.0000"; Flags: uninsdeletekey

Root: HKLM; Subkey: "SOFTWARE\FEAR2Game"; ValueName: "AppPath"; ValueType: String; ValueData: "{app}"; Flags: uninsdeletekey





[Files]

Source: "J:\FEAR 2 Project Origin\*"; DestDir: "{app}"; Flags: ignoreversion



Source: ISDone.dll; DestDir: {tmp}; Flags: dontcopy

#ifdef records

Source: records.inf; DestDir: {tmp}; Flags: dontcopy

#endif



#ifdef facompress

Source: Include\facompress.dll; DestDir: {tmp}; Flags: dontcopy

#endif





[CustomMessages]

russian.ExtractedFile=Извлекается файл:

russian.Extracted=Распаковка игровых архивов...

russian.CancelButton=Отменить распаковку

russian.Error=Ошибка распаковки!

russian.ElapsedTime=Прошло:

russian.RemainingTime=Осталось времени:

russian.EstimatedTime=Всего:

russian.AllElapsedTime=Время установки:



[UninstallDelete]

Type: filesandordirs; Name: {app}



[Code]

const

PCFonFLY=true;

notPCFonFLY=false;

var

LabelPct1,LabelCurrFileName,LabelTime1,LabelTime2,LabelTime3: TLabel;

ISDoneProgressBar1: TNewProgressBar;

#ifdef SecondProgressBar

LabelPct2: TLabel;

ISDoneProgressBar2:TNewProgressBar;

#endif

MyCancelButton: TButton;

ISDoneCancel:integer;

ISDoneError:boolean;

PCFVer:double;



type

TCallback = function (OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;



function WrapCallback(callback:TCallback; paramcount:integer):longword;external 'wrapcallback@files:ISDone.dll stdcall delayload';



function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';

function Exec2 (FileName, Param: PAnsiChar;Show:boolean):boolean; external 'Exec2@files:ISDone.dll stdcall delayload';

function ISFindFiles(CurComponent:Cardinal; FileMask:AnsiString; var ColFiles:integer):integer; external 'ISFindFiles@files:ISDone.dll stdcall delayload';

function ISPickFilename(FindHandle:integer; OutPath:AnsiString; var CurIndex:integer; DeleteInFile:boolean):boolean; external 'ISPickFilename@files:ISDone.dll stdcall delayload';

function ISGetName(TypeStr:integer):PAnsichar; external 'ISGetName@files:ISDone.dll stdcall delayload';

function ISFindFree(FindHandle:integer):boolean; external 'ISFindFree@files:ISDone.dll stdcall delayload';

function ISExec(CurComponent:Cardinal; PctOfTotal,SpecifiedProcessTime:double; ExeName,Parameters,TargetDir,OutputStr:AnsiString):boolean; external 'ISExec@files:ISDone.dll stdcall delayload';

function FileSearchInit(RecursiveSubDir:boolean):boolean; external 'FileSearchInit@files:ISDone.dll stdcall delayload';

function ISDoneInit(RecordFileName:AnsiString; TimeType,Comp1,Comp2,Comp3:Cardinal; WinHandle, NeededMem:longint; callback:TCallback):boolean; external 'ISDoneInit@files:ISDone.dll stdcall';

function ISDoneStop:boolean; external 'ISDoneStop@files:ISDone.dll stdcall';



function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;

begin

if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;

LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';

#ifdef SecondProgressBar

if CurrentPct<=1000 then ISDoneProgressBar2.Position := CurrentPct;

LabelPct2.Caption := IntToStr(CurrentPct div 10)+'.'+chr(48 + CurrentPct mod 10)+'%';

#endif

LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));

LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;

LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;

LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;

Result := ISDoneCancel;

end;



procedure CancelButtonOnClick(Sender: TObject);

begin

if MsgBox(SetupMessage(msgExitSetupMessage), mbConfirmation, MB_YESNO) = IDYES then ISDoneCancel:=1;

end;



procedure HideControls;

begin

WizardForm.FileNamelabel.Hide;

ISDoneProgressBar1.Hide;

LabelPct1.Hide;

LabelCurrFileName.Hide;

LabelTime1.Hide;

LabelTime2.Hide;

MyCancelButton.Hide;

#ifdef SecondProgressBar

ISDoneProgressBar2.Hide;

LabelPct2.Hide;

#endif

end;



procedure CreateControls;

var PBTop:integer;

begin

PBTop:=ScaleY(50);

ISDoneProgressBar1 := TNewProgressBar.Create(WizardForm);

with ISDoneProgressBar1 do begin

Parent := WizardForm.InstallingPage;

Height := WizardForm.ProgressGauge.Height;

Left := ScaleX(0);

Top := PBTop;

Width := ScaleX(365);

Max := 1000;

end;

LabelPct1 := TLabel.Create(WizardForm);

with LabelPct1 do begin

Parent := WizardForm.InstallingPage;

AutoSize := False;

Left := ISDoneProgressBar1.Width+ScaleX(5);

Top := ISDoneProgressBar1.Top + ScaleY(2);

Width := ScaleX(80);

end;

LabelCurrFileName := TLabel.Create(WizardForm);

with LabelCurrFileName do begin

Parent := WizardForm.InstallingPage;

AutoSize := False;

Width := ISDoneProgressBar1.Width+ScaleX(30);

Left := ScaleX(0);

Top := ScaleY(30);

end;

#ifdef SecondProgressBar

PBTop:=PBTop+ScaleY(25);

ISDoneProgressBar2 := TNewProgressBar.Create(WizardForm);

with ISDoneProgressBar2 do begin

Parent := WizardForm.InstallingPage;

Left := ScaleX(0);

Top := PBTop+ScaleY(8);

Width := ISDoneProgressBar1.Width;

Max := 1000;

Height := WizardForm.ProgressGauge.Height;

end;

LabelPct2 := TLabel.Create(WizardForm);

with LabelPct2 do begin

Parent := WizardForm.InstallingPage;

AutoSize := False;

Left := ISDoneProgressBar2.Width+ScaleX(5);

Top := ISDoneProgressBar2.Top + ScaleY(2);

Width := ScaleX(80);

end;

#endif

LabelTime1 := TLabel.Create(WizardForm);

with LabelTime1 do begin

Parent := WizardForm.InstallingPage;

AutoSize := False;

Width := ISDoneProgressBar1.Width div 2;

Left := ScaleX(0);

Top := PBTop + ScaleY(35);

end;

LabelTime2 := TLabel.Create(WizardForm);

with LabelTime2 do begin

Parent := WizardForm.InstallingPage;

AutoSize := False;

Width := LabelTime1.Width+ScaleX(40);

Left := ISDoneProgressBar1.Width div 2;

Top := LabelTime1.Top;

end;

LabelTime3 := TLabel.Create(WizardForm);

with LabelTime3 do begin

Parent := WizardForm.FinishedPage;

AutoSize := False;

Width := 300;

Left := 180;

Top := 200;

end;

MyCancelButton:=TButton.Create(WizardForm);

with MyCancelButton do begin

Parent:=WizardForm;

Width:=ScaleX(135);

Caption:=ExpandConstant('{cm:CancelButton}');

Left:=ScaleX(360);

Top:=WizardForm.cancelbutton.top;

OnClick:=@CancelButtonOnClick;

end;

end;



Procedure CurPageChanged(CurPageID: Integer);

Begin

if (CurPageID = wpFinished) and ISDoneError then

begin

LabelTime3.Hide;

WizardForm.Caption:= ExpandConstant('{cm:Error}');

WizardForm.FinishedLabel.Font.Color:= clRed;

WizardForm.FinishedLabel.Caption:= SetupMessage(msgSetupAborted) ;

end;

end;



function CheckError:boolean;

begin

result:= not ISDoneError;

end;



procedure CurStepChanged(CurStep: TSetupStep);

var Comps1,Comps2,Comps3, TmpValue:cardinal;

FindHandle1,ColFiles1,CurIndex1,tmp:integer;

ExecError:boolean;

InFilePath,OutFilePath,OutFileName:PAnsiChar;

begin

if CurStep = ssPostInstall then begin //Если необходимо, можно поменять на ssPostInstall

WizardForm.ProgressGauge.Hide;

WizardForm.CancelButton.Hide;

CreateControls;

WizardForm.StatusLabel.Caption:=ExpandConstant('{cm:Extracted}');

ISDoneCancel:=0;



// Распаковка всех необходимых файлов в папку {tmp}.

#ifdef facompress

ExtractTemporaryFile('facompress.dll'); //ускоряет распаковку .arc архивов.

#endif



#ifdef records

ExtractTemporaryFile('records.inf');

#endif



ISDoneError:=true;

if ISDoneInit(ExpandConstant('{src}\records.inf'), $F777, Comps1,Comps2,Comps3, MainForm.Handle, {#NeedMem}, @ProgressCallback) then begin

repeat

if not FileSearchInit(false) then break;



if not ISArcExtract ( 0, 0, ExpandConstant('{app}\*.arc'), ExpandConstant('{app}'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q PACK1.arc', ExpandConstant('{app}'), '...') then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q PACK2.arc', ExpandConstant('{app}'), '...') then break;



if not ISExec(0, 0, 0, ExpandConstant('{app}\rep.exe'), ' "Layer10.pcf.rep"',ExpandConstant('{app}'), 'Layer10.pcf') then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q Layer10.pcf.rep', ExpandConstant('{app}'), '...') then break;

if not ISExec(0, 0, 0, ExpandConstant('{app}\precomp.exe'), ExpandConstant('-r -o"{app}\Layer10.Arch01" "{app}\Layer10.pcf"'), ExpandConstant('{app}'), 'Layer10.Arch01') then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q Layer10.pcf', ExpandConstant('{app}'), '...') then break;



if not ISExec(0, 0, 0, ExpandConstant('{app}\rep.exe'), ' "Layer15.pcf.rep"',ExpandConstant('{app}'), 'Layer15.pcf') then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q Layer15.pcf.rep', ExpandConstant('{app}'), '...') then break;

if not ISExec(0, 0, 0, ExpandConstant('{app}\precomp.exe'), ExpandConstant('-r -o"{app}\Layer15.Arch01" "{app}\Layer15.pcf"'), ExpandConstant('{app}'), 'Layer15.Arch01') then break;

if not ISExec(0, 0, 0, 'cmd.exe', ' /C del /F /Q Layer15.pcf rep.exe msvcr80.dll packjpg_dll.dll zlib1.dll precomp.exe', ExpandConstant('{app}'), '...') then break;



ISDoneError:=false;

until true;

ISDoneStop;

end;

HideControls;

WizardForm.CancelButton.Visible:=true;

WizardForm.CancelButton.Enabled:=false;

end;

if (CurStep=ssPostInstall) and ISDoneError then begin

Exec2(ExpandConstant('{uninstallexe}'), '/VERYSILENT', false);

end;

end;

Раньше с многодисковыми установками сталкиваться не приходилось, потому вобще не представляю в чём дело.
У меня подозрения только на использование ssPostInstall а не штатного значения ssInstall

Gnom_aka_Lexander
30-05-2012, 18:14
zeroka_no_onna,
DiskSpanning=yes
SlicesPerDisk=3
DiskSliceSize=1566000000 эти строчки зачем? они нужны, когда упаковка средствами самого Inno. у IsDone усть своя функция запроса следующего диска.

GoshaPolo
30-05-2012, 18:38
Кто-нибудь мне подскажет все-таки как скрыть созданную дополнительно страницу? Какой у нее будет ID?

Gnom_aka_Lexander
30-05-2012, 18:51
GoshaPolo, Тебе ответили уже:
http://forum.oszone.net/post-1925022-125.html
Ее ID равен MyPage.ID.

GoshaPolo
30-05-2012, 19:03
Gnom_aka_Lexander, сорри не заметил того ответа. Но все же я не могу сообразить. Страницу я создал в расширенной версии компилятора от ResTools внутренними средствами, то есть не прописывал ее в коде. Как бы узнать какой у нее ID?

zeroka_no_onna
30-05-2012, 19:06
эти строчки зачем? они нужны, когда упаковка средствами самого Inno. у IsDone усть своя функция запроса следующего диска.

ISDone вцелом переусложнён и неудобен, вот именно и хотелось использовать его только для того, что само Inno не умеет - т.е. прогресса для сторонних упаковщиков.
Тут задумывалось что вначале само inno копирует с дисков, а затем уж IsDone + arc и т.п.
Ведь нужные ему файлы, всё в сетапе же должно быть?#define records
#define facompress вот эти и arc?

Гм, кстати, rep/precomp/packjpg и прочее у меня как-раз таки и не в сетапе.Хотя не пофиг ли ему где и есть ли они?
Вобшем, не понимаю.

Диски уже записаны потому переделывать поздно, на будущее хотелось разобраться в чём дело.

Gnom_aka_Lexander
30-05-2012, 19:22
GoshaPolo, код покажи.zeroka_no_onna, придется сперва почитать всетаки, справки по исдону. facompress - длл-ка которая ускоряет распаковку фриарк. records - директива, нужная для механизма равномерного заполнения прогрессбара. и все усложнение начинается с того момента, как запакованное во фриарк было засунуто в инсталл.

Raf-9600
30-05-2012, 19:23
Выглядеть будет так »
Благодарю. Меня ещё интересует:
1. Как сделать чтобы компонент выбирался и блокировался? У меня получается делать только что-то одно :(
2. Можно ли сделать чтобы правило выставления галочки в зависимости от компонента, не работало и в обратном направлении. Т.е. нужно чтобы если компонент выбран, то галочка ставилась, а если не выбран, то пользователь сам мог её поставить или убрать.

Грубо говоря, вот код, и последние два правила работают не так как нужно. Буду весьма признателен если подскажете как это скорректировать:


[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={pf}\My Application

[CustomMessages]
TypeOfInstallation=Тип установки:
Game=Игра
OnlyLocation=Только локализация
backup=Резервная копия
Text=Текст:
VoiceDiablo2=Озвучка Diablo 2:
VersionGame=Версия игры:

[Components]
Name: "Game"; Description: "{cm:TypeOfInstallation}"; Flags: disablenouninstallwarning;
Name: "Game\Full"; Description: "{cm:Game}"; Flags: exclusive disablenouninstallwarning; Types: full
Name: "Game\Lokal"; Description: "{cm:OnlyLocation}"; Flags: collapsed exclusive disablenouninstallwarning;
Name: "Game\Lokal\Backup"; Description: "{cm:backup}"; Flags: disablenouninstallwarning;


Name: "GameDiablo2"; Description: Diablo 2; Types: full
Name: "GameDiablo2\Text"; Description: "{cm:Text}"; Flags: collapsed; Types: full
Name: "GameDiablo2\VoiceD2"; Description: "{cm:VoiceDiablo2}"; Flags: collapsed; Types: full
Name: "Version"; Description: "{cm:VersionGame}"; Flags: collapsed disablenouninstallwarning;


[c0de]
var
OldEvent_ComponentsListClickCheck: TNotifyEvent;

procedure ComponentsListClickCheck(Sender: TObject);
var
i : Integer;
begin
for i := 0 to WizardForm.ComponentsList.ItemCount -1 do
begin
case WizardForm.ComponentsList.ItemCaption[i] of
'1.04c', '1.05b' : // перечисляем через запятую надписи компонентов, которые зависят от GameLoD
WizardForm.ComponentsList.ItemEnabled[i] := not (IsComponentSelected('GameLoD') or IsComponentSelected('Mod\PlugY'));

'1.07', '1.08' :
WizardForm.ComponentsList.ItemEnabled[i] := IsComponentSelected('GameLoD') and not IsComponentSelected('Mod\PlugY');

ExpandConstant('{cm:Text}'), ExpandConstant('{cm:VoiceDiablo2}'), ExpandConstant('{cm:VersionGame}') :
WizardForm.ComponentsList.Checked[i] := IsComponentSelected('Game\Full');

ExpandConstant('{cm:Text}'), ExpandConstant('{cm:VoiceDiablo2}'), ExpandConstant('{cm:VersionGame}') :
WizardForm.ComponentsList.ItemEnabled[i] := not IsComponentSelected('Game\Full');


end;
end;
OldEvent_ComponentsListClickCheck(Sender);
end;

procedure InitializeWizard();
begin
with WizardForm.ComponentsList do
begin
OldEvent_ComponentsListClickCheck := OnClickCheck;
OnClickCheck := @ComponentsListClickCheck;
ItemEnabled[3]:=True;
end;
end;

Gnom_aka_Lexander
30-05-2012, 19:39
Raf-9600,

'1.07', '1.08' :
WizardForm.ComponentsList.ItemEnabled[i] := IsComponentSelected('GameLoD') and not IsComponentSelected('Mod\PlugY');

ExpandConstant('{cm:Text}'), ExpandConstant('{cm:VoiceDiablo2}'), ExpandConstant('{cm:VersionGame}') :
begin
WizardForm.ComponentsList.Checked[i] := IsComponentSelected('Game\Full');
WizardForm.ComponentsList.ItemEnabled[i] := not IsComponentSelected('Game\Full');
end;

GoshaPolo
30-05-2012, 19:54
Gnom_aka_Lexander, кроме того, что ниже, в коде больше нет упоминания про эту страницу:


procedure RedesignWizardForm;
begin

ISCustomPage1 := CreateCustomPage(wpSelectProgramGroup, 'ISCustomPage1_Caption', 'ISCustomPage1_Description');

with ISCustomPage1.Surface do
begin
Name := 'ISCustomPage1';
end;

end;

Gnom_aka_Lexander
30-05-2012, 19:59
GoshaPolo, ISCustomPage1.ID




© OSzone.net 2001-2012