Jump to content
Korean Random

Создание инсталляторов для модпаков на базе Inno Setup


Recommended Posts

, ну на новой странице будет примерно так:

[Files]
 Source: "..."; DestDir: "{app}\..."; Flags: ignoreversion recursesubdirs createallsubdirs; Check: CheckBoxChecked(0);
 Source: "..."; DestDir: "{app}\..."; Flags: ignoreversion recursesubdirs createallsubdirs; Check: CheckBoxChecked(1);

[Code]
var
 CustomPage: TWizardPage;
 CustomListBox: TNewCheckListBox;

Procedure CreateCustomPage(PreviousPageId: Integer);
begin
 CustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');

 CustomListBox := TNewCheckListBox.Create(CustomPage);
 CustomListBox.Parent := CustomPage.Surface;
 CustomListBox.SetBounds(.., .., .., ..);
 и т.д.

 CustomListBox.AddCheckBox('0', '90.6 Мб', 0, True, True, True, False, nil);
 CustomListBox.AddCheckBox('1', '90.6 Мб', 1, True, True, True, True, nil);
end;

Function CheckBoxChecked(Idx: Integer): Boolean;
begin
 case Idx of 
 0:
  Result := CustomListBox.Checked[0];
 1:
  Result := CustomListBox.Checked[1];
 и т.д.
end;

Procedure InitializeWizard();
begin
 CreateCustomPage(wpSelectComponents);
end;

 

Кстати, там же ты спрашивал о логе. Дам подсказку: через функцию UpdateReadyMemo добавляешь имена компонентов со страницы твикера (тут я писал, как можно достать имя). А в лог можно записывать способом легче, чем пример от AtotIK`а. Вот так: WizardForm.ReadyMemo.Lines.SaveToFile(ExpandConstant('{app}\Log.txt')).

Link to comment
Short link
Share on other sites

, ну на новой странице будет примерно так:

[Files]
 Source: "..."; DestDir: "{app}\..."; Flags: ignoreversion recursesubdirs createallsubdirs; Check: CheckBoxChecked(0);
 Source: "..."; DestDir: "{app}\..."; Flags: ignoreversion recursesubdirs createallsubdirs; Check: CheckBoxChecked(1);

[Code]
var
 CustomPage: TWizardPage;
 CustomListBox: TNewCheckListBox;

Procedure CreateCustomPage(PreviousPageId: Integer);
begin
 CustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');

 CustomListBox := TNewCheckListBox.Create(CustomPage);
 CustomListBox.Parent := CustomPage.Surface;
 CustomListBox.SetBounds(.., .., .., ..);
 и т.д.

 CustomListBox.AddCheckBox('0', '90.6 Мб', 0, True, True, True, False, nil);
 CustomListBox.AddCheckBox('1', '90.6 Мб', 1, True, True, True, True, nil);
end;

Function CheckBoxChecked(Idx: Integer): Boolean;
begin
 case Idx of 
 0:
  Result := CustomListBox.Checked[0];
 1:
  Result := CustomListBox.Checked[1];
 и т.д.
end;

Procedure InitializeWizard();
begin
 CreateCustomPage(wpSelectComponents);
end;

 

Кстати, там же ты спрашивал о логе. Дам подсказку: через функцию UpdateReadyMemo добавляешь имена компонентов со страницы твикера (тут я писал, как можно достать имя). А в лог можно записывать способом легче, чем пример от AtotIK`а. Вот так: WizardForm.ReadyMemo.Lines.SaveToFile(ExpandConstant('{app}\Log.txt')).

ща буду пробовать,а такой вариант лога не подходит мне и то я уже сделал 

@Kotyarko_O

ошибка тут

CustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');
Link to comment
Short link
Share on other sites

, я забыл, что "CreateCustomPage" - зарезервированная функция. Пробуй так:

[Code]
var
 CustomPage: TWizardPage;
 CustomListBox: TNewCheckListBox;

Procedure CreateNewPage(PreviousPageId: Integer);
begin
 CustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');

 CustomListBox := TNewCheckListBox.Create(CustomPage);
 CustomListBox.Parent := CustomPage.Surface;
 CustomListBox.SetBounds(.., .., .., ..);
 и т.д.

 CustomListBox.AddCheckBox('0', '90.6 Мб', 0, True, True, True, False, nil);
 CustomListBox.AddCheckBox('1', '90.6 Мб', 1, True, True, True, True, nil);
end;

Function CheckBoxChecked(Idx: Integer): Boolean;
begin
 case Idx of
 0:
  Result := CustomListBox.Checked[0];
 1:
  Result := CustomListBox.Checked[1];
end;

Procedure InitializeWizard();
begin
 CreateNewPage(wpSelectComponents);
end;
Edited by Kotyarko_O
Link to comment
Short link
Share on other sites

 

, я забыл, что "CreateCustomPage" - зарезервированная функция. Пробуй так:

[Code]
var
 CustomPage: TWizardPage;
 CustomListBox: TNewCheckListBox;

Procedure CreateNewPage(PreviousPageId: Integer);
begin
 CustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');

 CustomListBox := TNewCheckListBox.Create(CustomPage);
 CustomListBox.Parent := CustomPage.Surface;
 CustomListBox.SetBounds(.., .., .., ..);
 и т.д.

 CustomListBox.AddCheckBox('0', '90.6 Мб', 0, True, True, True, False, nil);
 CustomListBox.AddCheckBox('1', '90.6 Мб', 1, True, True, True, True, nil);
end;

Function CheckBoxChecked(Idx: Integer): Boolean;
begin
 case Idx of
 0:
  Result := CustomListBox.Checked[0];
 1:
  Result := CustomListBox.Checked[1];
end;

Procedure InitializeWizard();
begin
 CreateNewPage(wpSelectComponents);
end;

ок

а почему сначала рисуется вторая стр,а потом первая?

[Code]
var
CustomPage: TWizardPage;
CustomListBox,CustomListBox1: TNewCheckListBox;
Procedure CreateNewPage(PreviousPageId: Integer);
begin
CustomPage := CreateCustomPage(PreviousPageId, 'первая', 'стр');
CustomListBox := TNewCheckListBox.Create(CustomPage);
CustomListBox.Parent := CustomPage.Surface;
CustomListBox.Left:=ScaleX(0);
  CustomListBox.Top:=ScaleY(23);
  CustomListBox.Width:=ScaleX(729);
  CustomListBox.Height:=ScaleY(248);
  CustomListBox.Cursor:=crHand;
  CustomListBox.BorderStyle:=bsSingle;
  CustomListBox.Color:=clWindow;
  CustomListBox.DragCursor:=crHand;
  CustomListBox.DragMode:=dmAutomatic;
  CustomListBox.Flat:=True;
  CustomListBox.Font.Color:=clBlue;
  CustomListBox.Font.Height:=-12;
  CustomListBox.Font.Name:='@Arial Unicode MS';
  CustomListBox.ParentFont:=False;
  CustomListBox.ShowLines:=True;
  CustomListBox.TreeViewStyle:=True;
  CustomListBox.ItemHeightFixed:=True;

CustomListBox.AddCheckBox('0', '90.6 Мб', 0, True, True, True, False, nil);
CustomListBox.AddCheckBox('1', '90.6 Мб', 1, True, True, True, True, nil);
end;
Procedure CreateNewPage1(PreviousPageId: Integer);
begin
CustomPage := CreateCustomPage(PreviousPageId, 'вторая', 'стр');
CustomListBox1 := TNewCheckListBox.Create(CustomPage);
CustomListBox1.Parent := CustomPage.Surface;
CustomListBox1.Left:=ScaleX(0);
  CustomListBox1.Top:=ScaleY(23);
  CustomListBox1.Width:=ScaleX(729);
  CustomListBox1.Height:=ScaleY(248);
  CustomListBox1.Cursor:=crHand;
  CustomListBox1.BorderStyle:=bsSingle;
  CustomListBox1.Color:=clWindow;
  CustomListBox1.DragCursor:=crHand;
  CustomListBox1.DragMode:=dmAutomatic;
  CustomListBox1.Flat:=True;
  CustomListBox1.Font.Color:=clBlue;
  CustomListBox1.Font.Height:=-12;
  CustomListBox1.Font.Name:='@Arial Unicode MS';
  CustomListBox1.ParentFont:=False;
  CustomListBox1.ShowLines:=True;
  CustomListBox1.TreeViewStyle:=True;
  CustomListBox1.ItemHeightFixed:=True;

CustomListBox1.AddCheckBox('2', '90.6 Мб', 0, True, True, True, False, nil);
CustomListBox1.AddCheckBox('3', '90.6 Мб', 1, True, True, True, True, nil);
end;
Function CheckBoxChecked1(Idx: Integer): Boolean;
begin
case Idx of
0:
  Result := CustomListBox.Checked[0];
1:
  Result := CustomListBox.Checked[1];
end;
end;
Function CheckBoxChecked2(Idx: Integer): Boolean;
begin
case Idx of
0:
  Result := CustomListBox1.Checked[0];
1:
  Result := CustomListBox1.Checked[1];
end;
end;

Function CheckBoxChecked(Idx: Integer): Boolean;
begin
CheckBoxChecked1(Idx);
CheckBoxChecked2(Idx);
end;

Procedure InitializeWizard();
begin
CreateNewPage(wpSelectComponents);
CreateNewPage1(wpSelectComponents);

end;

Link to comment
Short link
Share on other sites

 

 

а почему сначала рисуется вторая стр,а потом первая?
Как тут перечислено:
Procedure InitializeWizard();
begin
CreateNewPage(wpSelectComponents);
CreateNewPage1(wpSelectComponents);
end;

так и создаётся.

Link to comment
Short link
Share on other sites

Как тут перечислено:

Procedure InitializeWizard();
begin
CreateNewPage(wpSelectComponents);
CreateNewPage1(wpSelectComponents);
end;

так и создаётся.

 

ну тут сначала первая а потом вторая 

Edited by Dark_Knight_MiX
Link to comment
Short link
Share on other sites

а почему  менять,странно как то 

не логично

Это ты не логичный) То, что ты прописываешь само создание страниц (или чего-либо другого), ничего не сделает, пока ты не применишь это в какой-то внешней функции. И неважно, в каком порядке прописано то, что ты написал. Программа всё выполнит по очереди, из внешней функции.

Edited by Kotyarko_O
Link to comment
Short link
Share on other sites

Это ты не логичный) То, что ты прописываешь само создание страниц (или чего-либо другого), ничего не сделает, пока ты не применишь это в какой-то внешней функции. И неважно, в каком порядке прописано то, что ты написал. Программа всё выполнит по очереди, из внешней функции.

а что не так?

чего то не хватает?

это чтоль 

procedure CurPageChanged(CurPageID: Integer);
begin
    if CurPageID = wpSelectComponents then
end;
Edited by Dark_Knight_MiX
Link to comment
Short link
Share on other sites

пока ты не применишь это в какой-то внешней функции. И неважно, в каком порядке прописано то, что ты написал. Программа всё выполнит по очереди, из внешней функции.

вот я про это

Link to comment
Short link
Share on other sites

вот я про это

Мая твая нипанимать. Я так и не уловил суть того, что ты хочешь.

 

Там по ссылке перечислены все внешние, какую из них применять - зависит от твоих потребностей.

Edited by Kotyarko_O
Link to comment
Short link
Share on other sites

а можно вместо номера компонента сделать его название?

 

[Code]
type
  TComponentDesc = record Description: String; Index: Integer; end;
var
  Descs: array of TComponentDesc;
  Info: TNewStaticText;
  InfoCaption: TNewStaticText;
  InfoPanel: TPanel;
  Indx: Integer;
procedure ShowDescription(Sender: TObject; X, Y, Index: Integer; Area: TItemArea);
var i: Integer;
begin
  Indx:=-1;
  for i:= 0 to GetArrayLength(Descs)-1 do begin
  if (Descs[i].Index=Index) then begin Indx:=i; Break end; end;
  if (Indx >=0)and(Area=iaItem) then Info.Caption:= Descs[Indx].Description else Info.Caption:= ExpandConstant('{cm:ComponentsInfoPanel2}');
end;
procedure AddDescription(AIndex: Integer; ADescription: String);
var i, k: Integer;
begin
i:= GetArrayLength(Descs); SetArrayLength(Descs, i+1);
Descs[i].Description:= ADescription; Descs[i].Index:= AIndex-1
end;
procedure InitializeWizard();
begin
  WizardForm.TypesCombo.Visible:=False;
  WizardForm.ComponentsList.Height := ScaleY(181) - WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Top := WizardForm.TypesCombo.Top;
  WizardForm.ComponentsList.Width := ScaleX(417);
  WizardForm.ComponentsList.OnItemMouseMove:= @ShowDescription
  InfoPanel := TPanel.Create(WizardForm);
  InfoPanel.Parent := WizardForm.SelectComponentsPage;
  InfoPanel.Caption := '';
  InfoPanel.Top := ScaleY(190);
  InfoPanel.Left := ScaleX(0);
  InfoPanel.Width := ScaleX(417);
  InfoPanel.Height := ScaleY(40);
  InfoPanel.BevelInner := bvRaised;
  InfoPanel.BevelOuter := bvLowered;
  InfoCaption := TNewStaticText.Create(WizardForm);
  InfoCaption.Parent := WizardForm.SelectComponentsPage;
  InfoCaption.Caption := ExpandConstant('{cm:ComponentsInfoPanel1}');
  InfoCaption.Left := ScaleX(7);
  InfoCaption.Top := InfoPanel.Top - ScaleY(6);
  InfoCaption.Font.Color := clActiveCaption;
  Info := TNewStaticText.Create(WizardForm);
  Info.Parent := InfoPanel;
  Info.AutoSize := False;
  Info.Left := ScaleX(6);
  Info.Width := ScaleX(403);
  Info.Top := ScaleY(12);
  Info.Height := ScaleY(24);
  Info.Caption := ExpandConstant('{cm:ComponentsInfoPanel2}');
  Info.WordWrap := true;
  AddDescription(1, 'Справка'); //первый параметр - это номер компонента, идет последовательно от начала записи компонентов
  AddDescription(2, 'Английская справка'); //Второй параметр - это собственно описание компонента
  AddDescription(3, 'Русская справка');
  AddDescription(4, 'Плагины');
  AddDescription(5, 'Внутреннего просмотра');
  AddDescription(6, 'Архиваторные');
  AddDescription(13, 'Системные');
  AddDescription(8, 'CanonCam');
  AddDescription(9, 'PluginManager');
  AddDescription(10, 'Registry');
  AddDescription(11, 'Services');
  AddDescription(12, 'StartupGuard');
  AddDescription(7, 'Другие');


как сделать так что бы наоборот при снятии галочки появлялось окно?


[Components]
Name: comp1; Description: "Установить ...";  Types: full;
Name: comp2; Description: "Удалить ...";
[Code]
procedure ComponentsListOnClickCheck(Sender: TObject);
begin
  if (WizardForm.ComponentsList.ItemIndex = 0) and IsComponentSelected('comp1') then
   MsgBox('Comp1 on click', mbInformation, MB_YESNO);
end;
procedure InitializeWizard;
begin
  WizardForm.ComponentsList.OnClickCheck:=@ComponentsListOnClickCheck;
end;
Edited by Dark_Knight_MiX
Link to comment
Short link
Share on other sites

 

 

как сделать так что бы наоборот при снятии галочки появлялось окно?
[Components]
Name: comp1; Description: "Установить ...";  Types: full;
Name: comp2; Description: "Удалить ...";

[Code]
procedure ComponentsListOnClickCheck(Sender: TObject);
begin
  if (WizardForm.ComponentsList.ItemIndex = 0) and not IsComponentSelected('comp1') then
   MsgBox('Comp1 on click', mbInformation, MB_YESNO);
end;
 
procedure InitializeWizard;
begin
  WizardForm.ComponentsList.OnClickCheck:=@ComponentsListOnClickCheck;
end;
Link to comment
Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...